Skip to main content

SPinBox

Type Alias SPinBox 

Source
pub type SPinBox<T, S> = State<StorageStateOwnedPinBox, T, S>;
Expand description

Owned state whose runtime value is stored in Pin<Box<T>>.

This is the pinned counterpart to SBox. Pinning consumes a boxed state rather than raw T, again preserving the already-proven current state.

Pinned storage is deliberately not just “boxed plus SMut”. For T: !Unpin, the backend can expose Pin<&T> and Pin<&mut T> through SPinRef and SPinMut, but it does not expose &mut T. That means ordinary transitions requiring S: SMut stay unavailable, while pinned transition methods can still be written:

impl Connection {
    fn connect<S>(self: State<S, Self, Disconnected>) -> State<S, Self, Connected>
    where
        S: magicstatemachines::SPinMut,
    {
        magicstatemachines::transition!(pin self)
    }
}

Aliased Type§

pub struct SPinBox<T, S> { /* private fields */ }