Struct mesh::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 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] = _
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
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)
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<'_>)
MessageEncode::compute_message_size
.source§fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
fn write_message(self, writer: MessageWriter<'_, '_, Resource>)
MessageEncode::write_message
.