Skip to main content

MayTransition

Trait MayTransition 

Source
pub trait MayTransition: StateStorage {
    // Required method
    fn complete_transition<T, From, To, Args>(
        state: State<Self, T, From>,
        args: Args,
        callsite: TransitionCallsite,
    ) -> State<Self, T, To>
       where T: StateMachineImpl,
             From: StateTrait,
             To: ConcreteStateTrait,
             T::Standin: Transition<From, To>,
             <T::Standin as Transition<From, To>>::F: TransitionSignature<Args>;
}
Expand description

Storage backend whose state token may be consumed and retagged by a transition.

StateStorage only describes how a typed state view is represented. This trait is the additional capability required to complete a transition after the state-machine contract has proven that the edge is legal.

Read-only storage backends intentionally do not implement this trait. For example, immutable shared borrows implement SRef so read-only methods can run, but they cannot complete transition! calls. Mutable, pinned-mutable, and move-capable storage inherit this capability through SMut, SPinMut, and SMove.

Required Methods§

Source

fn complete_transition<T, From, To, Args>( state: State<Self, T, From>, args: Args, callsite: TransitionCallsite, ) -> State<Self, T, To>
where T: StateMachineImpl, From: StateTrait, To: ConcreteStateTrait, T::Standin: Transition<From, To>, <T::Standin as Transition<From, To>>::F: TransitionSignature<Args>,

Retags a state after checking that Args matches the declared transition signature.

Storage backends normally delegate this to their inner representation. Implementation crates should call transitions through transition! rather than invoking this method directly.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl MayTransition for StorageStateOwned

Source§

impl MayTransition for StorageStateOwnedBox

Source§

impl MayTransition for StorageStateOwnedPinBox

Available on crate feature alloc only.
Source§

impl<'a, Backend> MayTransition for StorageStateMut<'a, Backend>
where Backend: SharedStorageView + 'a,