Skip to main content

Waiter

Struct Waiter 

Source
pub struct Waiter<'a> { /* private fields */ }
Expand description

A waiter registered for a tag of the I/O stream.

The waiter and poll_ready complete once IoRef::wake is called for the tag, all waiters of the tag are woken together. They also complete once the I/O stream is closed. The first poll registers the waiter, a wake is reported to a registered waiter even if it happens between polls, once reported the next poll registers again. A waiter that is not registered misses the wake. Dropping the waiter releases its registration.

Implementations§

Source§

impl<'a> Waiter<'a>

Source

pub fn new(io: &'a IoRef, tag: usize) -> Waiter<'a> ⓘ

Creates a waiter for the tag.

§Panics

Panics in debug builds if the tag is reserved for internal use, usize::MAX - 1 and usize::MAX - 2 are reserved.

Source

pub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<()>

Polls until the tag is woken.

Completes once the I/O stream is closed.

Source

pub fn into_static(self) -> Waiter<'static> ⓘ

Converts the waiter into one that owns its IoRef.

The registration of the waiter is kept.

Trait Implementations§

Source§

impl Clone for Waiter<'_>

Source§

fn clone(&self) -> Waiter<'_> ⓘ

Creates an unregistered waiter for the same tag.

1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for Waiter<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Drop for Waiter<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Future for Waiter<'_>

Source§

type Output = ()

The type of value produced on completion.
Source§

fn poll( self: Pin<&mut Waiter<'_>>, cx: &mut Context<'_>, ) -> Poll<<Waiter<'_> as Future>::Output>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more

Auto Trait Implementations§

§

impl<'a> !Freeze for Waiter<'a>

§

impl<'a> !RefUnwindSafe for Waiter<'a>

§

impl<'a> !Send for Waiter<'a>

§

impl<'a> !Sync for Waiter<'a>

§

impl<'a> !UnwindSafe for Waiter<'a>

§

impl<'a> Unpin for Waiter<'a>

§

impl<'a> UnsafeUnpin for Waiter<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
Source§

impl<F> OnDropFutureExt for F
where F: Future,

Source§

fn on_drop<F>(self, on_drop: F) -> OnDropFuture<Self, F> ⓘ
where F: FnOnce(),

Wraps this future so that on_drop is called if the future is dropped before it completes. The callback is cancelled once the future completes, whatever its output.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.