Skip to main content

StateUnionDiscriminant

Trait StateUnionDiscriminant 

Source
pub trait StateUnionDiscriminant: Sized + StateMarker<Kind = UnionStateKind> {
    type Enum<Storage, T>
       where Storage: StateStorage,
             T: StateMachineImpl;
}
Expand description

Selects the value-carrying enum type for a union marker.

StateUnion! implements this for the generated marker. For StateUnion!(Online: Connected | Authenticated), the associated Enum is OnlineEnum<Storage, T> unless a custom enum name was supplied.

Users normally do not implement this trait manually. It is useful in generic APIs that need to name the enum associated with a marker:

type OnlineValue<S, T> =
    <Online as magicstatemachines::StateUnionDiscriminant>::Enum<S, T>;

Required Associated Types§

Source

type Enum<Storage, T> where Storage: StateStorage, T: StateMachineImpl

Generated enum that can hold any concrete member state of this union.

For StateUnion!(Online: Connected | Authenticated), this is OnlineEnum<Storage, T> unless a custom enum name was supplied.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§