Struct Waker

pub(crate) struct Waker { pub(in ::sync::mpmc::waker) selectors: Vec<Entry>, pub(in ::sync::mpmc::waker) observers: Vec<Entry> }

A queue of threads blocked on channel operations.

This data structure is used by threads to register blocking operations and get woken up once an operation becomes ready.

Fields

selectors: Vec<Entry>

A list of select operations.

observers: Vec<Entry>

A list of operations waiting to be ready.

Implementations

impl Waker

fn new() -> Self

Creates a new Waker.

fn register(&mut self, oper: Operation, cx: &Context)

Registers a select operation.

fn register_with_packet(&mut self, oper: Operation, packet: *mut (), cx: &Context)

Registers a select operation and a packet.

fn unregister(&mut self, oper: Operation) -> Option<Entry>

Unregisters a select operation.

fn try_select(&mut self) -> Option<Entry>

Attempts to find another thread's entry, select the operation, and wake it up.

fn notify(&mut self)

Notifies all operations waiting to be ready.

fn disconnect(&mut self)

Notifies all registered operations that the channel is disconnected.

Trait Implementations

impl Drop for Waker

fn drop(&mut self)

Auto Trait Implementations

impl !Send for Waker

impl !Sync for Waker

impl Freeze for Waker

impl RefUnwindSafe for Waker

impl Unpin for Waker

impl UnsafeUnpin for Waker

impl UnwindSafe for Waker

Blanket Implementations

impl<T> Any for Waker where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Waker where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Waker where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for Waker

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for Waker where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for Waker

impl<T, U> Into<U> for Waker where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Waker 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 Waker where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>