[−][src]Struct async_wakers::Wakers
A container allowing task Waker
s 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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,