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 new() -> WorkflowCancellationToken
pub fn new() -> WorkflowCancellationToken
Create a detached cancellation token.
Sourcepub fn child_token(&self) -> WorkflowCancellationToken
pub fn child_token(&self) -> WorkflowCancellationToken
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
pub fn cancelled(&self) -> impl FusedFuture
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
Source§impl Default for WorkflowCancellationToken
impl Default for WorkflowCancellationToken
Source§fn default() -> WorkflowCancellationToken
fn default() -> WorkflowCancellationToken
Returns the “default value” for a type. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§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