pub struct Context {
inner: Arc<Inner>,
}
Expand description
Thread-local context.
Fields§
§inner: Arc<Inner>
Implementations§
source§impl Context
impl Context
sourcepub fn with<F, R>(f: F) -> Rwhere
F: FnOnce(&Context) -> R,
pub fn with<F, R>(f: F) -> Rwhere F: FnOnce(&Context) -> R,
Creates a new context for the duration of the closure.
sourcepub fn try_select(&self, select: Selected) -> Result<(), Selected>
pub fn try_select(&self, select: Selected) -> Result<(), Selected>
Attempts to select an operation.
On failure, the previously selected operation is returned.
sourcepub fn store_packet(&self, packet: *mut ())
pub fn store_packet(&self, packet: *mut ())
Stores a packet.
This method must be called after try_select
succeeds and there is a packet to provide.
sourcepub fn wait_until(&self, deadline: Option<Instant>) -> Selected
pub fn wait_until(&self, deadline: Option<Instant>) -> Selected
Waits until an operation is selected and returns it.
If the deadline is reached, Selected::Aborted
will be selected.
Trait Implementations§
Auto Trait Implementations§
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