pub enum WorkflowState {
Started,
InProgress(String),
Suspended(String),
Completed,
Failed(String),
}Expand description
Observable state of a workflow instance.
Returned via an Invocation from Engine::invoke. Callers
observe state transitions or drop the handle for fire-and-forget
execution.
§Examples
use memable::WorkflowState;
let state = WorkflowState::InProgress("syncing records".into());
assert_eq!(state.to_string(), "in progress: syncing records");Variants§
Started
The workflow has been submitted but has not yet started executing.
InProgress(String)
The workflow is executing and has reported a status message.
Suspended(String)
The workflow is suspended, awaiting an external signal.
Completed
The workflow completed successfully.
Failed(String)
The workflow failed with an error message.
Implementations§
Source§impl WorkflowState
impl WorkflowState
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Returns true if this is a terminal state (Completed or Failed).
§Examples
use memable::WorkflowState;
assert!(WorkflowState::Completed.is_terminal());
assert!(WorkflowState::Failed("err".into()).is_terminal());
assert!(!WorkflowState::Started.is_terminal());Sourcepub fn message(&self) -> Option<&str>
pub fn message(&self) -> Option<&str>
Returns the message carried by this state, if any.
Started and Completed carry
no message and return None. All other variants return the inner
string.
§Examples
use memable::WorkflowState;
let state = WorkflowState::InProgress("loading".into());
assert_eq!(state.message(), Some("loading"));
assert_eq!(WorkflowState::Completed.message(), None);Trait Implementations§
Source§impl Clone for WorkflowState
impl Clone for WorkflowState
Source§fn clone(&self) -> WorkflowState
fn clone(&self) -> WorkflowState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkflowState
impl Debug for WorkflowState
Source§impl Display for WorkflowState
impl Display for WorkflowState
Source§impl PartialEq for WorkflowState
impl PartialEq for WorkflowState
Source§fn eq(&self, other: &WorkflowState) -> bool
fn eq(&self, other: &WorkflowState) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for WorkflowState
impl StructuralPartialEq for WorkflowState
Auto Trait Implementations§
impl Freeze for WorkflowState
impl RefUnwindSafe for WorkflowState
impl Send for WorkflowState
impl Sync for WorkflowState
impl Unpin for WorkflowState
impl UnsafeUnpin for WorkflowState
impl UnwindSafe for WorkflowState
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