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§

source

fn unwrap(self) -> T

Returns the value contained in a Poll::Ready value or panics.

source

fn expect(self, msg: &str) -> T

Returns the value contained in a Poll::Ready value or panics with a custom message.

source

fn expect_pending(&self, msg: &str)

Expect a Poll to be Pending, or panics with a custom message.

source

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)

source

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.

Implementations on Foreign Types§

source§

impl<T> PollExt<T> for Poll<T>

source§

fn unwrap(self) -> T

source§

fn expect(self, msg: &str) -> T

source§

fn expect_pending(&self, msg: &str)

source§

fn ready_or<E>(self, error: E) -> Result<T, E>

source§

fn ready_or_else<E, F>(self, error: F) -> Result<T, E>
where F: FnOnce() -> E,

Implementors§