[][src]Trait sm::Initializer

pub trait Initializer<S: InitialState> {
    type Machine: Machine<State = S, Event = NoneEvent>;
    fn new(state: S) -> Self::Machine;
}

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.

Associated Types

Machine represents the machine which the implemented initialiser should return.

Required Methods

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

Implementors