Struct crossbeam_channel::context::Context
source · pub struct Context {
inner: Arc<Inner>,
}
Expand description
Thread-local context used in select.
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_packet(&self) -> *mut ()
pub fn wait_packet(&self) -> *mut ()
Waits until a packet is provided and returns it.
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.