Sleepers

Struct Sleepers 

Source
pub(crate) struct Sleepers {
    pub(crate) count: usize,
    pub(crate) wakers: Vec<(usize, Waker)>,
    pub(crate) free_ids: Vec<usize>,
}
Expand description

A list of sleeping tickers.

Fields§

§count: usize

Number of sleeping tickers (both notified and unnotified).

§wakers: Vec<(usize, Waker)>

IDs and wakers of sleeping unnotified tickers.

A sleeping ticker is notified when its waker is missing from this list.

§free_ids: Vec<usize>

Reclaimed IDs.

Implementations§

Source§

impl Sleepers

Source

pub(crate) fn insert(&mut self, waker: &Waker) -> usize

Inserts a new sleeping ticker.

Source

pub(crate) fn update(&mut self, id: usize, waker: &Waker) -> bool

Re-inserts a sleeping ticker’s waker if it was notified.

Returns true if the ticker was notified.

Source

pub(crate) fn remove(&mut self, id: usize) -> bool

Removes a previously inserted sleeping ticker.

Returns true if the ticker was notified.

Source

pub(crate) fn is_notified(&self) -> bool

Returns true if a sleeping ticker is notified or no tickers are sleeping.

Source

pub(crate) fn notify(&mut self) -> Option<Waker>

Returns notification waker for a sleeping ticker.

If a ticker was notified already or there are no tickers, None will be returned.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.