Trait Initializer

Source
pub trait Initializer<S: InitialState> {
    type Machine: Machine<State = S, Event = NoneEvent>;

    // Required method
    fn new(state: S) -> Self::Machine;
}
Expand description

Initializer defines the new method on a machine, that accepts any state marked as InitialState, and returns a new machine.

If you are using the sm! macro, then there is no need to interact with this trait.

Required Associated Types§

Source

type Machine: Machine<State = S, Event = NoneEvent>

Machine represents the machine which the implemented initialiser should return.

Required Methods§

Source

fn new(state: S) -> Self::Machine

new initialises a new machine, based on the provided InitialState as input.

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§