pub struct WorkflowCancellationToken { /* private fields */ }Expand description
A deterministic cancellation token for workflow operations.
Tokens created with WorkflowCancellationToken::new are detached from workflow
cancellation. Use WorkflowCancellationToken::child_token to create a token that is
cancelled when its parent is cancelled.
Implementations§
Source§impl WorkflowCancellationToken
impl WorkflowCancellationToken
Sourcepub fn child_token(&self) -> Self
pub fn child_token(&self) -> Self
Create a token that is cancelled when this token is cancelled.
Sourcepub fn cancel_with_reason(&self, reason: impl Into<String>)
pub fn cancel_with_reason(&self, reason: impl Into<String>)
Cancel this token with a reason.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Return whether this token has been cancelled.
Sourcepub fn reason(&self) -> Option<String>
pub fn reason(&self) -> Option<String>
Return the first cancellation reason, if one was provided.
Sourcepub fn cancelled(&self) -> impl FusedFuture<Output = ()> + '_
pub fn cancelled(&self) -> impl FusedFuture<Output = ()> + '_
Return a future that resolves when this token is cancelled.
Trait Implementations§
Source§impl Clone for WorkflowCancellationToken
impl Clone for WorkflowCancellationToken
Source§fn clone(&self) -> WorkflowCancellationToken
fn clone(&self) -> WorkflowCancellationToken
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 WorkflowCancellationToken
impl Debug for WorkflowCancellationToken
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowCancellationToken
impl !Send for WorkflowCancellationToken
impl !Sync for WorkflowCancellationToken
impl !UnwindSafe for WorkflowCancellationToken
impl Freeze for WorkflowCancellationToken
impl Unpin for WorkflowCancellationToken
impl UnsafeUnpin for WorkflowCancellationToken
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request