Skip to main content

Initial

Trait Initial 

Source
pub trait Initial<TState> { }
Expand description

Declares that a definition crate permits TState as an initial state.

This trait is normally emitted by StateMachineDefinition!. It is the proof used by State::new, StateOwned::new, and shared-state constructors: creating a fresh state token only compiles for states declared in the definition crate.

pub struct ConnectionStandin;
pub struct Disconnected;

impl magicstatemachines::Initial<Disconnected> for ConnectionStandin {}

Most users should not write that impl manually; prefer:

magicstatemachines::StateMachineDefinition! {
    for ConnectionStandin;

    pub Initial: Disconnected;
}

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§