pub struct CancelContext { /* private fields */ }
Expand description
A cancellation context.
This is used to get a notification when an operation has been cancelled. It can be cloned or sent across process boundaries.
Implementations§
Source§impl CancelContext
impl CancelContext
Sourcepub fn new() -> CancelContext
pub fn new() -> CancelContext
Returns a new context that is never notified of cancellation.
Sourcepub fn with_cancel(&self) -> (CancelContext, Cancel)
pub fn with_cancel(&self) -> (CancelContext, Cancel)
Returns a new child context and a cancel function.
The new context is notified when either this context is cancelled, or
the returned Cancel
object’s cancel
method is called.
Sourcepub fn with_deadline(&self, deadline: Deadline) -> CancelContext
pub fn with_deadline(&self, deadline: Deadline) -> CancelContext
Returns a new child context with a deadline.
The new context is notified when either this context is cancelled, or the deadline is exceeded.
Sourcepub fn with_timeout(&self, timeout: Duration) -> CancelContext
pub fn with_timeout(&self, timeout: Duration) -> CancelContext
Returns a new child context with a timeout.
The new context is notified when either this context is cancelled, or the timeout has expired.
Sourcepub fn cancelled(&mut self) -> Cancelled<'_> ⓘ
pub fn cancelled(&mut self) -> Cancelled<'_> ⓘ
Returns a future that completes when the context is cancelled.
Sourcepub async fn until_cancelled<F>(
&mut self,
fut: F,
) -> Result<<F as Future>::Output, CancelReason>where
F: Future,
pub async fn until_cancelled<F>(
&mut self,
fut: F,
) -> Result<<F as Future>::Output, CancelReason>where
F: Future,
Runs fut
until this context is cancelled.
Trait Implementations§
Source§impl Clone for CancelContext
impl Clone for CancelContext
Source§fn clone(&self) -> CancelContext
fn clone(&self) -> CancelContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for CancelContext
impl Debug for CancelContext
Source§impl Default for CancelContext
impl Default for CancelContext
Source§fn default() -> CancelContext
fn default() -> CancelContext
Source§impl DefaultEncoding for CancelContext
impl DefaultEncoding for CancelContext
Source§type Encoding = TableEncoder
type Encoding = TableEncoder
Source§impl Drop for CancelContext
impl Drop for CancelContext
Source§impl<'encoding> StructDecodeMetadata<'encoding, Resource> for CancelContext
impl<'encoding> StructDecodeMetadata<'encoding, Resource> for CancelContext
Source§const DECODERS: &'static [ErasedDecoderEntry] = _
const DECODERS: &'static [ErasedDecoderEntry] = _
Source§impl StructEncodeMetadata<Resource> for CancelContext
impl StructEncodeMetadata<Resource> for CancelContext
Source§const ENCODERS: &'static [ErasedEncoderEntry] = _
const ENCODERS: &'static [ErasedEncoderEntry] = _
Auto Trait Implementations§
impl Freeze for CancelContext
impl !RefUnwindSafe for CancelContext
impl Send for CancelContext
impl Sync for CancelContext
impl Unpin for CancelContext
impl !UnwindSafe for CancelContext
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
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> MeshField for Twhere
T: DefaultEncoding,
<T as DefaultEncoding>::Encoding: FieldEncode<T, Resource> + for<'a> FieldDecode<'a, T, Resource> + Send + Sync,
impl<T> MeshField for Twhere
T: DefaultEncoding,
<T as DefaultEncoding>::Encoding: FieldEncode<T, Resource> + for<'a> FieldDecode<'a, T, Resource> + Send + Sync,
type Encoding = <T as DefaultEncoding>::Encoding
Source§impl<T> MeshPayload for Twhere
T: DefaultEncoding + Any + Send + 'static,
<T as DefaultEncoding>::Encoding: MessageEncode<T, Resource> + for<'a> MessageDecode<'a, T, Resource> + FieldEncode<T, Resource> + for<'a> FieldDecode<'a, T, Resource> + Send + Sync,
impl<T> MeshPayload for Twhere
T: DefaultEncoding + Any + Send + 'static,
<T as DefaultEncoding>::Encoding: MessageEncode<T, Resource> + for<'a> MessageDecode<'a, T, Resource> + FieldEncode<T, Resource> + for<'a> FieldDecode<'a, T, Resource> + Send + Sync,
type Encoding = <T as DefaultEncoding>::Encoding
Source§impl<T> SerializeMessage for Twhere
T: 'static + MeshPayload + Send,
impl<T> SerializeMessage for Twhere
T: 'static + MeshPayload + Send,
Source§fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
MessageEncode::compute_message_size
.Source§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
MessageEncode::write_message
.