pub struct ConversionJobStateMachine { /* private fields */ }Expand description
State machine for ConversionJob workflow
Implementations§
Source§impl ConversionJobStateMachine
impl ConversionJobStateMachine
Sourcepub fn from_state(state: ConversionJobState) -> Self
pub fn from_state(state: ConversionJobState) -> Self
Create from an existing state
Sourcepub fn current_state(&self) -> ConversionJobState
pub fn current_state(&self) -> ConversionJobState
Get the current state
Sourcepub fn can_transition(&self, transition: ConversionJobTransition) -> bool
pub fn can_transition(&self, transition: ConversionJobTransition) -> bool
Check if a transition is allowed from the current state
Sourcepub fn can_transition_with_role(
&self,
transition: ConversionJobTransition,
role: &str,
) -> bool
pub fn can_transition_with_role( &self, transition: ConversionJobTransition, role: &str, ) -> bool
Check if a transition is allowed for a given role
Sourcepub fn transition(
&mut self,
transition: ConversionJobTransition,
) -> Result<ConversionJobState, StateMachineError>
pub fn transition( &mut self, transition: ConversionJobTransition, ) -> Result<ConversionJobState, StateMachineError>
Apply a transition, returning the new state
Sourcepub fn transition_with_role(
&mut self,
transition: ConversionJobTransition,
role: &str,
) -> Result<ConversionJobState, StateMachineError>
pub fn transition_with_role( &mut self, transition: ConversionJobTransition, role: &str, ) -> Result<ConversionJobState, StateMachineError>
Apply a transition with role check
Sourcepub fn available_transitions(&self) -> Vec<ConversionJobTransition>
pub fn available_transitions(&self) -> Vec<ConversionJobTransition>
Get all available transitions from the current state
Sourcepub fn available_transitions_for_role(
&self,
role: &str,
) -> Vec<ConversionJobTransition>
pub fn available_transitions_for_role( &self, role: &str, ) -> Vec<ConversionJobTransition>
Get all available transitions for a given role
Sourcepub fn transition_to_state(
&mut self,
target: ConversionJobState,
) -> Result<ConversionJobState, StateMachineError>
pub fn transition_to_state( &mut self, target: ConversionJobState, ) -> Result<ConversionJobState, 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 ConversionJobStateMachine
impl Clone for ConversionJobStateMachine
Source§impl Debug for ConversionJobStateMachine
impl Debug for ConversionJobStateMachine
Auto Trait Implementations§
impl Freeze for ConversionJobStateMachine
impl RefUnwindSafe for ConversionJobStateMachine
impl Send for ConversionJobStateMachine
impl Sync for ConversionJobStateMachine
impl Unpin for ConversionJobStateMachine
impl UnsafeUnpin for ConversionJobStateMachine
impl UnwindSafe for ConversionJobStateMachine
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.