Struct mesh_channel::cancel::CancelContext
source · 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 with_cancel(&self) -> (Self, Cancel)
pub fn with_cancel(&self) -> (Self, 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) -> Self
pub fn with_deadline(&self, deadline: Deadline) -> Self
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) -> Self
pub fn with_timeout(&self, timeout: Duration) -> Self
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: Future>(
&mut self,
fut: F,
) -> Result<F::Output, CancelReason>
pub async fn until_cancelled<F: Future>( &mut self, fut: F, ) -> Result<F::Output, CancelReason>
Runs fut
until this context is cancelled.
Trait Implementations§
source§impl Clone for CancelContext
impl Clone for CancelContext
source§impl Debug for CancelContext
impl Debug for CancelContext
source§impl Default for CancelContext
impl Default for CancelContext
source§impl DefaultEncoding for CancelContext
impl DefaultEncoding for CancelContext
source§type Encoding = TableEncoder
type Encoding = TableEncoder
The encoding to use for the serialization. Read more
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] = _
The list of decoder vtables.
source§impl StructEncodeMetadata<Resource> for CancelContext
impl StructEncodeMetadata<Resource> for CancelContext
source§const ENCODERS: &'static [ErasedEncoderEntry] = _
const ENCODERS: &'static [ErasedEncoderEntry] = _
The list of encoder vtables.
source§impl StructMetadata for CancelContext
impl StructMetadata for CancelContext
impl Downcast<CancelContext> for CancelContext
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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 + Any + Send + 'static,
<T as DefaultEncoding>::Encoding: FieldEncode<T, Resource> + for<'a> FieldDecode<'a, T, Resource> + Send + Sync,
impl<T> MeshField for Twhere
T: DefaultEncoding + Any + Send + 'static,
<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: MeshPayload,
impl<T> SerializeMessage for Twhere
T: MeshPayload,
source§fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
fn compute_message_size(&mut self, sizer: MessageSizer<'_>)
Computes the message size, as in
MessageEncode::compute_message_size
.source§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
Writes the message, as in
MessageEncode::write_message
.source§fn extract(self) -> <T as SerializeMessage>::Concrete
fn extract(self) -> <T as SerializeMessage>::Concrete
Extract the concrete message.