pub struct Invocation { /* private fields */ }Expand description
Handle for a running workflow instance.
Returned by Engine::invoke and Engine::resume. Provides the
instance ID and a status channel for observing WorkflowState
transitions.
§Examples
let state = engine.invoke("greet").await?.wait().await;
assert_eq!(state, WorkflowState::Completed(None));Implementations§
Source§impl Invocation
impl Invocation
Sourcepub fn instance_id(&self) -> &str
pub fn instance_id(&self) -> &str
Returns the instance ID for this invocation.
§Examples
let invocation = engine.invoke("wf").await?;
println!("Instance: {}", invocation.instance_id());Sourcepub fn status(&mut self) -> &mut Receiver<WorkflowState>
pub fn status(&mut self) -> &mut Receiver<WorkflowState>
Returns a mutable reference to the status receiver.
For simple cases, prefer wait. Use this
method when you need to observe intermediate state transitions.
§Examples
let mut invocation = engine.invoke("wf").await?;
while invocation.status().changed().await.is_ok() {
if invocation.status().borrow().is_terminal() { break; }
}Sourcepub async fn wait(self) -> WorkflowState
pub async fn wait(self) -> WorkflowState
Waits until the workflow reaches a terminal state.
Returns the final WorkflowState (Completed or Failed).
§Examples
let state = engine.invoke("wf").await?.wait().await;
assert_eq!(state, WorkflowState::Completed(None));Sourcepub fn into_parts(self) -> (String, Receiver<WorkflowState>)
pub fn into_parts(self) -> (String, Receiver<WorkflowState>)
Decomposes into the instance ID and status receiver.
§Examples
let (id, mut status) = engine.invoke("wf").await?.into_parts();
println!("Started instance {id}");Auto Trait Implementations§
impl Freeze for Invocation
impl RefUnwindSafe for Invocation
impl Send for Invocation
impl Sync for Invocation
impl Unpin for Invocation
impl UnsafeUnpin for Invocation
impl UnwindSafe for Invocation
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