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§
Sourcefn 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>,
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§
impl MayTransition for StorageStateOwned
impl MayTransition for StorageStateOwnedBox
impl MayTransition for StorageStateOwnedPinBox
alloc only.