Required for #253 and must greatly simplify codebase.
Right now I have InternalState, FullState, PartialState, TmpPartialState structs and GameState trait which is implemented for all of them. This greatly complicates #253 (see comments) because you need generalized code in some places and concrete struct in other places + it introduses a few lifetime-related problems with TmpPartialState.
So I want to try to merge all this into one universal State struct which can fill all these roles and will not have any lifetime parameters.
The only way to achieve this that I see is to use "option hack": have an for: Option<Fow> fields in the struct and insert/extract (using Option::take and movement semantics) it for switching between FullState/PartialState roles.
Demo: https://play.rust-lang.org/?gist=401412510e667a291c151b84b7be6a98
Required for #253 and must greatly simplify codebase.
Right now I have
InternalState,FullState,PartialState,TmpPartialStatestructs andGameStatetrait which is implemented for all of them. This greatly complicates #253 (see comments) because you need generalized code in some places and concrete struct in other places + it introduses a few lifetime-related problems withTmpPartialState.So I want to try to merge all this into one universal
Statestruct which can fill all these roles and will not have any lifetime parameters.The only way to achieve this that I see is to use "option hack": have an
for: Option<Fow>fields in the struct and insert/extract (usingOption::takeand movement semantics) it for switching betweenFullState/PartialStateroles.Demo: https://play.rust-lang.org/?gist=401412510e667a291c151b84b7be6a98