futures_util::future

Trait TryFuture

Source
pub trait TryFuture: Future + Sealed {
    type Ok;
    type Error;

    // Required method
    fn try_poll(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
    ) -> Poll<Result<Self::Ok, Self::Error>>;
}
Expand description

A convenience for futures that return Result values that includes a variety of adapters tailored to such futures.

Required Associated Types§

Source

type Ok

The type of successful values yielded by this future

Source

type Error

The type of failures yielded by this future

Required Methods§

Source

fn try_poll( self: Pin<&mut Self>, cx: &mut Context<'_>, ) -> Poll<Result<Self::Ok, Self::Error>>

Poll this TryFuture as if it were a Future.

This method is a stopgap for a compiler limitation that prevents us from directly inheriting from the Future trait; in the future it won’t be needed.

Implementors§

Source§

impl<F, T, E> TryFuture for F
where F: Future<Output = Result<T, E>> + ?Sized,

Source§

type Ok = T

Source§

type Error = E