pub struct UploadSessionStateMachine { /* private fields */ }Expand description
State machine for UploadSession workflow
Implementations§
Source§impl UploadSessionStateMachine
impl UploadSessionStateMachine
Sourcepub fn from_state(state: UploadSessionState) -> Self
pub fn from_state(state: UploadSessionState) -> Self
Create from an existing state
Sourcepub fn current_state(&self) -> UploadSessionState
pub fn current_state(&self) -> UploadSessionState
Get the current state
Sourcepub fn can_transition(&self, transition: UploadSessionTransition) -> bool
pub fn can_transition(&self, transition: UploadSessionTransition) -> bool
Check if a transition is allowed from the current state
Sourcepub fn can_transition_with_role(
&self,
transition: UploadSessionTransition,
role: &str,
) -> bool
pub fn can_transition_with_role( &self, transition: UploadSessionTransition, role: &str, ) -> bool
Check if a transition is allowed for a given role
Sourcepub fn transition(
&mut self,
transition: UploadSessionTransition,
) -> Result<UploadSessionState, StateMachineError>
pub fn transition( &mut self, transition: UploadSessionTransition, ) -> Result<UploadSessionState, StateMachineError>
Apply a transition, returning the new state
Sourcepub fn transition_with_role(
&mut self,
transition: UploadSessionTransition,
role: &str,
) -> Result<UploadSessionState, StateMachineError>
pub fn transition_with_role( &mut self, transition: UploadSessionTransition, role: &str, ) -> Result<UploadSessionState, StateMachineError>
Apply a transition with role check
Sourcepub fn available_transitions(&self) -> Vec<UploadSessionTransition>
pub fn available_transitions(&self) -> Vec<UploadSessionTransition>
Get all available transitions from the current state
Sourcepub fn available_transitions_for_role(
&self,
role: &str,
) -> Vec<UploadSessionTransition>
pub fn available_transitions_for_role( &self, role: &str, ) -> Vec<UploadSessionTransition>
Get all available transitions for a given role
Sourcepub fn transition_to_state(
&mut self,
target: UploadSessionState,
) -> Result<UploadSessionState, StateMachineError>
pub fn transition_to_state( &mut self, target: UploadSessionState, ) -> Result<UploadSessionState, StateMachineError>
Attempt to transition directly to a target state.
Finds any transition that leads to the target state and applies it. Returns Err if no valid transition leads from current state to target.
Trait Implementations§
Source§impl Clone for UploadSessionStateMachine
impl Clone for UploadSessionStateMachine
Source§impl Debug for UploadSessionStateMachine
impl Debug for UploadSessionStateMachine
Auto Trait Implementations§
impl Freeze for UploadSessionStateMachine
impl RefUnwindSafe for UploadSessionStateMachine
impl Send for UploadSessionStateMachine
impl Sync for UploadSessionStateMachine
impl Unpin for UploadSessionStateMachine
impl UnsafeUnpin for UploadSessionStateMachine
impl UnwindSafe for UploadSessionStateMachine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.