pub struct Context {
inner: Arc<Inner>,
}
🔬This is a nightly-only experimental API. (
mpmc_channel
#126840)Expand description
Thread-local context.
Fields§
§inner: Arc<Inner>
🔬This is a nightly-only experimental API. (
mpmc_channel
#126840)Implementations§
Source§impl Context
impl Context
Sourcepub fn with<F, R>(f: F) -> R
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub fn with<F, R>(f: F) -> R
mpmc_channel
#126840)Creates a new context for the duration of the closure.
Sourcefn new() -> Context
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
fn new() -> Context
mpmc_channel
#126840)Creates a new Context
.
Sourcefn reset(&self)
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
fn reset(&self)
mpmc_channel
#126840)Resets select
and packet
.
Sourcepub fn try_select(&self, select: Selected) -> Result<(), Selected>
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub fn try_select(&self, select: Selected) -> Result<(), Selected>
mpmc_channel
#126840)Attempts to select an operation.
On failure, the previously selected operation is returned.
Sourcepub fn store_packet(&self, packet: *mut ())
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub fn store_packet(&self, packet: *mut ())
mpmc_channel
#126840)Stores a packet.
This method must be called after try_select
succeeds and there is a packet to provide.
Sourcepub unsafe fn wait_until(&self, deadline: Option<Instant>) -> Selected
🔬This is a nightly-only experimental API. (mpmc_channel
#126840)
pub unsafe fn wait_until(&self, deadline: Option<Instant>) -> Selected
mpmc_channel
#126840)Waits until an operation is selected and returns it.
If the deadline is reached, Selected::Aborted
will be selected.
§Safety
This may only be called from the thread this Context
belongs to.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
🔬This is a nightly-only experimental API. (
sized_type_properties
)The largest safe length for a
[Self]
. Read more