Moves SavedFrame behind a Arc<Mutex<_>> wrapper called SavedCell for safely passing back to the API consumer in the form of Commands. This should allow a safer targeted control
SaveState and LoadState are made to be single-use write-through structs that allow loading and saving game state in a controlled manner.
SaveState implements Drop in debug mode only, which will panic if the provided client implementation did not write out to its SavedCell before dropping it.
Replaced all &mut impl SessionCallbacks<T> with &mut Vec<Command<T>> instead.
This has the added benefit of removing another generic parameter from all of the associated functions, so compile times should be faster.
The public facing API is simpler, is more idiomatic than the callbacks being used from before, and removes the nasty lifetime interactions it had with reference based callbacks from before.
Currently missing:
[x] a newtyped Commands and CommandsIterator types that strictly forbid all operations other than non-consuming iteration and sequential construction to ensure correctness on both the client and Backroll's ends.
Still a draft. There are some notable parts that require alteration to help prevent users of the API from shooting themselves in the foot.
This implements the proposal from #6.
SavedFrame
behind aArc<Mutex<_>>
wrapper calledSavedCell
for safely passing back to the API consumer in the form ofCommand
s. This should allow a safer targeted controlSaveState
andLoadState
are made to be single-use write-through structs that allow loading and saving game state in a controlled manner.SaveState
implementsDrop
in debug mode only, which will panic if the provided client implementation did not write out to itsSavedCell
before dropping it.&mut impl SessionCallbacks<T>
with&mut Vec<Command<T>>
instead.This has the added benefit of removing another generic parameter from all of the associated functions, so compile times should be faster.
The public facing API is simpler, is more idiomatic than the callbacks being used from before, and removes the nasty lifetime interactions it had with reference based callbacks from before.
Currently missing:
Commands
andCommandsIterator
types that strictly forbid all operations other than non-consuming iteration and sequential construction to ensure correctness on both the client and Backroll's ends.Still a draft. There are some notable parts that require alteration to help prevent users of the API from shooting themselves in the foot.