Skip to main content

Machine

Trait Machine 

Source
pub trait Machine<E> {
    type State;

    // Required method
    fn process_event(&mut self, event: E) -> bool;

    // Provided method
    fn process_event_async(&mut self, event: E) -> impl Future<Output = bool> { ... }
}
Expand description

Common synchronous interface implemented by generated state machines that do not require a temporary context.

Required Associated Types§

Source

type State

Generated state enum.

Required Methods§

Source

fn process_event(&mut self, event: E) -> bool

Processes one event to run-to-completion and reports whether it was accepted.

Provided Methods§

Source

fn process_event_async(&mut self, event: E) -> impl Future<Output = bool>

Processes one event to run-to-completion and returns its acceptance as a future. The default inline path does not allocate.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§