[][src]Struct async_wakers::Wakers

pub struct Wakers(_);

A container allowing task Wakers to register themselves to be notified later (eg. when data becomes available).

The registered wakers can be notified using one of two methods:

  • notify_one notifies a waker that hasn't been notified recently (unless if it was updated after);
  • notify_all notifies all the wakers that haven't been notified recently (unless if they were updated after).

Methods

impl Wakers[src]

pub fn new() -> Self[src]

Constructs a new, empty Wakers.

pub fn ready(&self) -> usize[src]

Returns the number of wakers that are ready to be notified.

pub fn register(&self, waker: Waker) -> Registration[src]

Registers a new Waker and returns a Registration handle to update and remove it.

pub fn unregister(&self, registration: Registration) -> Option<Waker>[src]

Unregisters a waker using its Registration handle and returns it, or None if it has been notified recently (and not updated after) or if it has already been unregistered.

pub fn clear(&self)[src]

Unregisters all wakers.

pub fn notify_one(&self) -> bool[src]

Notifies a waker that hasn't been notified recently (unless if it was updated after) and returns whether one could be found and notified.

This method returns false if no waker has been registered or is ready (ie. if all wakers were recently notified and none were updated after).

pub fn notify_all(&self) -> usize[src]

Notifies all registered wakers that haven`t been notified recently (unless if they were updated after) and returns the number of wakers that were notified.

This method returns 0 if no waker has been registered is ready (ie. if all wakers were recently notified and none were updated after).

Trait Implementations

impl Clone for Wakers[src]

impl Debug for Wakers[src]

impl Default for Wakers[src]

Auto Trait Implementations

impl !RefUnwindSafe for Wakers

impl Send for Wakers

impl Sync for Wakers

impl Unpin for Wakers

impl !UnwindSafe for Wakers

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.