pub trait StateMachine:
Send
+ Sync
+ 'static {
type State: Serialize + DeserializeOwned + Clone + Default + Send + Sync;
// Required methods
fn apply<'life0, 'async_trait>(
&'life0 mut self,
command: StateMachineCommand,
) -> Pin<Box<dyn Future<Output = StateMachineResponse> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, OperatorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn restore<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), OperatorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn state(&self) -> &Self::State;
}Required Associated Types§
Required Methods§
fn apply<'life0, 'async_trait>(
&'life0 mut self,
command: StateMachineCommand,
) -> Pin<Box<dyn Future<Output = StateMachineResponse> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn snapshot<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, OperatorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn restore<'life0, 'life1, 'async_trait>(
&'life0 mut self,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), OperatorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn state(&self) -> &Self::State
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".