Skip to main content

StateKind

Trait StateKind 

Source
pub trait StateKind: Sized {
    type RuntimeState<Marker>: StateTrait + StateMarker
       where Marker: StateRuntimeMarkerFor<Self>;
    type Proof<T, From, Marker, To>
       where T: StateMachineImpl,
             From: StateTrait + StateMarker<Kind = Self>,
             Marker: StateUnionDiscriminant,
             To: StateTrait + StateMarker<Kind = ConcreteStateKind>;
}
Expand description

Classifies state marker types.

End users usually interact with this indirectly through States! and StateUnion!. Concrete states use ConcreteStateKind, while generated union markers use UnionStateKind.

The kind is what lets generic transition helpers choose different proof machinery without exposing separate public transition methods. A concrete state proves transitions directly from From -> To. A union marker proves transitions through the generated union membership/discrimination logic.

You normally do not implement this trait. If you need custom state markers, prefer wrapping them in States! so the marker kind, erased-state support, and ZST invariants are all wired consistently.

Required Associated Types§

Source

type RuntimeState<Marker>: StateTrait + StateMarker where Marker: StateRuntimeMarkerFor<Self>

Runtime marker actually checked by shared storage for this kind.

Concrete states resolve to themselves. Union markers resolve to their generated joint [StateUnionState].

Source

type Proof<T, From, Marker, To> where T: StateMachineImpl, From: StateTrait + StateMarker<Kind = Self>, Marker: StateUnionDiscriminant, To: StateTrait + StateMarker<Kind = ConcreteStateKind>

Proof type used by generated transition helpers for this kind.

This associated type lets the macro-generated transition code select concrete-state proof logic or union-state proof logic without exposing separate public methods.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl StateKind for ConcreteStateKind

Source§

type RuntimeState<Marker> = <Marker as StateRuntimeMarkerFor<ConcreteStateKind>>::RuntimeState where Marker: StateRuntimeMarkerFor<Self>

Source§

type Proof<T, From, Marker, To> = StateConcreteTransitionProof<T, From, Marker, To> where T: StateMachineImpl, From: StateTrait + StateMarker<Kind = Self>, Marker: StateUnionDiscriminant, To: StateTrait + StateMarker<Kind = ConcreteStateKind>

Source§

impl StateKind for UnionStateKind

Source§

type RuntimeState<Marker> = <Marker as StateRuntimeMarkerFor<UnionStateKind>>::RuntimeState where Marker: StateRuntimeMarkerFor<Self>

Source§

type Proof<T, From, Marker, To> = StateUnionTransitionProof<T, From, Marker, To> where T: StateMachineImpl, From: StateTrait + StateMarker<Kind = Self>, Marker: StateUnionDiscriminant, To: StateTrait + StateMarker<Kind = ConcreteStateKind>