Trait async_utils::traits::PollExt
source · pub trait PollExt<T> {
// Required methods
fn unwrap(self) -> T;
fn expect(self, msg: &str) -> T;
fn expect_pending(&self, msg: &str);
fn ready_or<E>(self, error: E) -> Result<T, E>;
fn ready_or_else<E, F>(self, error: F) -> Result<T, E>
where F: FnOnce() -> E;
}
Expand description
An extension trait for core::task::Poll
that provides convenient adapters for extracting
output values.
Required Methods§
sourcefn expect(self, msg: &str) -> T
fn expect(self, msg: &str) -> T
Returns the value contained in a Poll::Ready value or panics with a custom message.
sourcefn expect_pending(&self, msg: &str)
fn expect_pending(&self, msg: &str)
Expect a Poll to be Pending, or panics with a custom message.
sourcefn ready_or<E>(self, error: E) -> Result<T, E>
fn ready_or<E>(self, error: E) -> Result<T, E>
Turns a Poll into a Result, mapping Poll::Ready(value) to Ok(value) and Poll::Pending to Err(error)
sourcefn ready_or_else<E, F>(self, error: F) -> Result<T, E>where
F: FnOnce() -> E,
fn ready_or_else<E, F>(self, error: F) -> Result<T, E>where
F: FnOnce() -> E,
Turns a Poll into a Result, mapping Poll::Ready(value) to Ok(value) and Poll::Pending to Err(error())
Object Safety§
This trait is not object safe.