Skip to main content

StateMarker

Trait StateMarker 

Source
pub trait StateMarker: 'static {
    type Kind: StateKind;
}
Expand description

Common trait implemented by concrete states and generated union markers.

Concrete state ZSTs generated by States! implement this with ConcreteStateKind. Union markers generated by StateUnion! implement it with UnionStateKind.

Manual implementations are advanced API. The implementation must be a ZST marker and must return a stable erased marker for concrete states. This is why the recommended definition-crate pattern is:

pub mod states {
    magicstatemachines::States! {
        /// The machine is idle.
        Idle;
        /// The machine is running.
        Running;
    }
}

Required Associated Types§

Source

type Kind: StateKind

Whether this marker is a concrete state or a union marker.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§