Struct Context
pub struct Context { pub(in ::sync::mpmc::context) inner: Arc<Inner> }
Thread-local context.
Fields
inner: Arc<Inner>
Implementations
impl Context
fn with<F, R>(f: F) -> R where F: FnOnce(&Context) -> R,Creates a new context for the duration of the closure.
fn new() -> ContextCreates a new
Context.fn reset(&self)Resets
selectandpacket.fn try_select(&self, select: Selected) -> Result<(), Selected>Attempts to select an operation.
On failure, the previously selected operation is returned.
fn store_packet(&self, packet: *mut ())Stores a packet.
This method must be called after
try_selectsucceeds and there is a packet to provide.unsafe fn wait_until(&self, deadline: Option<Instant>) -> SelectedWaits until an operation is selected and returns it.
If the deadline is reached,
Selected::Abortedwill be selected.Safety
This may only be called from the thread this
Contextbelongs to.fn unpark(&self)Unparks the thread this context belongs to.
fn thread_id(&self) -> usizeReturns the id of the thread this context belongs to.
Trait Implementations
impl Clone for Context
fn clone(&self) -> Context
impl Debug for Context
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
Blanket Implementations
impl<T> Any for Context
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Context
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Context
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Context
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Context
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Context
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Context
impl<T> ToOwned for Context
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Context
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Context
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Context
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>