pub trait ObjectStateManager {
// Provided methods
fn load_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 mut self,
state_loader: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>
where T: IdentifiableType + Serialize + DeserializeOwned + Default + 'async_trait,
S: StateLoader<T> + Send + Sync + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn save_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 self,
state_saver: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>
where T: IdentifiableType + Serialize + DeserializeOwned + Sync + Default + 'async_trait,
S: StateSaver<T> + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Reponsible for managing states for a specific object
With this trait one can load/save individual states from an orig (Self) object
Provided Methods§
Sourcefn load_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 mut self,
state_loader: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>where
T: IdentifiableType + Serialize + DeserializeOwned + Default + 'async_trait,
S: StateLoader<T> + Send + Sync + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 mut self,
state_loader: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>where
T: IdentifiableType + Serialize + DeserializeOwned + Default + 'async_trait,
S: StateLoader<T> + Send + Sync + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Send + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load the state from the backend, deserialize it, and map it into the right state
Sourcefn save_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 self,
state_saver: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>where
T: IdentifiableType + Serialize + DeserializeOwned + Sync + Default + 'async_trait,
S: StateSaver<T> + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save_state<'life0, 'life1, 'async_trait, T, S>(
&'life0 self,
state_saver: &'life1 S,
) -> Pin<Box<dyn Future<Output = Result<(), LoadStateError>> + Send + 'async_trait>>where
T: IdentifiableType + Serialize + DeserializeOwned + Sync + Default + 'async_trait,
S: StateSaver<T> + 'async_trait,
Self: State<T> + IdentifiableType + WithId + Send + Sync + Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Serialize the data out of the state and save it to the backend provided
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.