Skip to main content

ConcreteStated

Struct ConcreteStated 

Source
pub struct ConcreteStated<T, S>
where S: StateMarker<Kind = ConcreteStateKind>,
{ /* private fields */ }
Expand description

Raw runtime data paired with a concrete state marker.

ConcreteStated<T, S> is the narrow escape hatch for implementation-owned construction. It does not dereference to T and it does not support transitions; it can only be created unsafely or by helpers generated in the implementation module, then consumed by State::from_concrete to create a directly owned state.

Creating this value asserts that the raw T really satisfies the invariant represented by concrete state S. For public construction, prefer State::new, which is gated by Initial. For implementation-owned conversions, use the private with_state_priv helper generated by StateMachineImpl!.

Implementations§

Source§

impl<T, S> ConcreteStated<T, S>
where S: StateMarker<Kind = ConcreteStateKind>,

Source

pub unsafe fn new(value: T) -> Self

Attaches raw runtime data to a concrete state marker.

§Safety

The caller must prove by construction that value is valid for state S. This function can forge typestate authority if used incorrectly.

Source

pub fn into_raw(self) -> T

Removes the concrete state marker and returns the raw runtime value.

Auto Trait Implementations§

§

impl<T, S> Freeze for ConcreteStated<T, S>
where T: Freeze,

§

impl<T, S> RefUnwindSafe for ConcreteStated<T, S>
where T: RefUnwindSafe,

§

impl<T, S> Send for ConcreteStated<T, S>
where T: Send,

§

impl<T, S> StateClone for ConcreteStated<T, S>
where T: StateClone,

§

impl<T, S> StateCopy for ConcreteStated<T, S>
where T: StateCopy,

§

impl<T, S> Sync for ConcreteStated<T, S>
where T: Sync,

§

impl<T, S> Unpin for ConcreteStated<T, S>
where T: Unpin,

§

impl<T, S> UnsafeUnpin for ConcreteStated<T, S>
where T: UnsafeUnpin,

§

impl<T, S> UnwindSafe for ConcreteStated<T, S>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.