pub struct WorkflowCtx<S: Context> {
pub store: S,
/* private fields */
}Expand description
The context for a workflow execution.
The context contains the store, cancellation token, and optional timeout.
Fields§
§store: SThe store for the workflow.
Implementations§
Source§impl<S: Context> WorkflowCtx<S>
impl<S: Context> WorkflowCtx<S>
Sourcepub fn with_store<F, R>(&self, f: F) -> R
pub fn with_store<F, R>(&self, f: F) -> R
Runs the provided function with a reference to the store.
Sourcepub fn cancel_token(&self) -> &CancellationToken
pub fn cancel_token(&self) -> &CancellationToken
Returns a reference to the cancellation token.
Sourcepub fn set_timeout(&mut self, d: Duration)
pub fn set_timeout(&mut self, d: Duration)
Sets a timeout for the workflow.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Returns true if the workflow has been cancelled.
Sourcepub async fn run_future<R, F>(&self, fut: F) -> Result<R, FloxideError>
pub async fn run_future<R, F>(&self, fut: F) -> Result<R, FloxideError>
Runs the provided future, respecting cancellation and optional timeout.
Trait Implementations§
Source§impl<S: Clone + Context> Clone for WorkflowCtx<S>
impl<S: Clone + Context> Clone for WorkflowCtx<S>
Source§fn clone(&self) -> WorkflowCtx<S>
fn clone(&self) -> WorkflowCtx<S>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Context> RetryDelay for WorkflowCtx<S>
impl<S: Context> RetryDelay for WorkflowCtx<S>
Auto Trait Implementations§
impl<S> Freeze for WorkflowCtx<S>where
S: Freeze,
impl<S> RefUnwindSafe for WorkflowCtx<S>where
S: RefUnwindSafe,
impl<S> Send for WorkflowCtx<S>
impl<S> Sync for WorkflowCtx<S>
impl<S> Unpin for WorkflowCtx<S>where
S: Unpin,
impl<S> UnwindSafe for WorkflowCtx<S>where
S: UnwindSafe,
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