pub trait In<Marker>: StateTrait + StateMarkerwhere
Marker: StateMarker,{
// Required method
fn into_discriminated<Storage, T>(
state: State<Storage, T, Self>,
) -> DiscriminatedState<Storage, T, Marker>
where Self: Sized,
Storage: StateStorage,
T: StateMachineImpl,
Marker: StateUnionDiscriminant;
}Expand description
Marks a state as being a concrete marker or a member of a generated state union.
Every concrete state implements In<Self>. Generated union membership
traits such as InOnline extend In<Online> and add sealing/proof bounds.
Prefer the generated trait (InOnline) in normal function signatures. The
generated trait carries the sealed union contract and any generated
super-union relationships, so a value accepted as impl InOnline can also
be used with APIs that accept wider generated traits such as impl InAll.
A bare impl In<Online> proves only membership in that one marker and does
not give Rust the same widened trait bounds.
fn endpoint<S>(self: &State<S, Connection, impl InOnline>) -> &str
where
S: SRef,
{
&self.endpoint
}Use the generic form (In<Online>) when the marker is itself a type
parameter, or when calling the associated conversion function explicitly.
It is a lower-level building block, not the best ergonomic bound for public
methods:
fn to_online<S, Current>(
state: State<S, Connection, Current>,
) -> DiscriminatedState<S, Connection, Online>
where
S: StateStorage,
Current: In<Online>,
{
<Current as In<Online>>::into_discriminated(state)
}Required Methods§
Sourcefn into_discriminated<Storage, T>(
state: State<Storage, T, Self>,
) -> DiscriminatedState<Storage, T, Marker>
fn into_discriminated<Storage, T>( state: State<Storage, T, Self>, ) -> DiscriminatedState<Storage, T, Marker>
Converts a concrete member state into the union’s discriminated state.
The returned DiscriminatedState keeps enough runtime information to
recover the concrete enum variant later with discriminate().
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".