clementine_core::states

Trait ContextProcessor

Source
pub(crate) trait ContextProcessor<T: Owner, M: IntoStateMachine> {
    // Required method
    fn process_with_ctx(
        self,
        block: &StateContext<T>,
    ) -> ContextProcessResult<T, M, impl Future<Output = (InitializedStateMachine<M>, StateContext<T>)> + Send>;
}
Expand description

Utility trait to make processing generic

Required Methods§

Source

fn process_with_ctx( self, block: &StateContext<T>, ) -> ContextProcessResult<T, M, impl Future<Output = (InitializedStateMachine<M>, StateContext<T>)> + Send>

Processes the machine with the given state context (which contains the block cache) If the machine is unchanged, it is returned as is. Otherwise, the machine is processed and the result is returned as a future that processes the new events.

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.

Implementations on Foreign Types§

Source§

impl<T, M> ContextProcessor<T, M> for InitializedStateMachine<M>
where T: Owner, for<'evt, 'ctx> M: IntoStateMachine<Event<'evt> = M::StateEvent, Context<'ctx> = StateContext<T>> + Send + BlockMatcher + Clone, M::State: State<M> + 'static + Send, for<'sub> M::Superstate<'sub>: Superstate<M> + Send, for<'evt> M::Event<'evt>: Send + Sync,

Generic implementation for all state machines

Source§

fn process_with_ctx( self, block: &StateContext<T>, ) -> ContextProcessResult<T, M, impl Future<Output = (Self, StateContext<T>)> + Send>

Implementors§