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>
impl<'a> Waiter<'a>
Sourcepub fn new(io: &'a IoRef, tag: usize) -> Self
pub fn new(io: &'a IoRef, tag: usize) -> Self
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.
Sourcepub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<()>
pub fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<()>
Polls until the tag is woken.
Completes once the I/O stream is closed.
Sourcepub fn into_static(self) -> Waiter<'static> ⓘ
pub fn into_static(self) -> Waiter<'static> ⓘ
Converts the waiter into one that owns its IoRef.
The registration of the waiter is kept.