Trait State

Source
pub trait State:
    Debug
    + Clone
    + Eq
    + PartialEq
    + Hash
    + Encodable
    + Decodable
    + MaybeSend
    + MaybeSync
    + 'static {
    type ModuleContext: Context;

    // Required methods
    fn transitions(
        &self,
        context: &Self::ModuleContext,
        global_context: &DynGlobalClientContext,
    ) -> Vec<StateTransition<Self>>;
    fn operation_id(&self) -> OperationId;
}
Expand description

Implementors act as state machines that can be executed

Required Associated Types§

Source

type ModuleContext: Context

Additional resources made available in this module’s state transitions

Required Methods§

Source

fn transitions( &self, context: &Self::ModuleContext, global_context: &DynGlobalClientContext, ) -> Vec<StateTransition<Self>>

All possible transitions from the current state to other states. See StateTransition for details.

Source

fn operation_id(&self) -> OperationId

Operation this state machine belongs to. See OperationId for details.

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.

Implementors§