pub enum WorkflowState {
Started,
InProgress(String),
Suspended {
key: String,
status: String,
},
Completed(Option<String>),
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
The workflow is suspended, awaiting an external signal.
key is the step key where the workflow suspended (e.g. "approval:v1").
status is the human-readable message set via
SuspendBuilder::status, or the key
itself if no custom status was provided.
Fields
Completed(Option<String>)
The workflow completed successfully.
Contains the last status message set via
Context::set_status before the
workflow returned, or None if no status was ever set.
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(None).is_terminal());
assert!(WorkflowState::Failed("err".into()).is_terminal());
assert!(!WorkflowState::Started.is_terminal());Trait Implementations§
Source§impl Clone for WorkflowState
impl Clone for WorkflowState
Source§fn clone(&self) -> WorkflowState
fn clone(&self) -> WorkflowState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
self and other values to be equal, and is used by ==.