Trait futures_util::compat::Future01CompatExt
source · [−]pub trait Future01CompatExt: Future01 {
fn compat(self) -> Compat01As03<Self>ⓘNotable traits for Compat01As03<Fut>impl<Fut: Future01> Future for Compat01As03<Fut> type Output = Result<Fut::Item, Fut::Error>;
where
Self: Sized,
{ ... }
}
Expand description
Extension trait for futures 0.1 Future
Provided methods
fn compat(self) -> Compat01As03<Self>ⓘNotable traits for Compat01As03<Fut>impl<Fut: Future01> Future for Compat01As03<Fut> type Output = Result<Fut::Item, Fut::Error>;
where
Self: Sized,
fn compat(self) -> Compat01As03<Self>ⓘNotable traits for Compat01As03<Fut>impl<Fut: Future01> Future for Compat01As03<Fut> type Output = Result<Fut::Item, Fut::Error>;
where
Self: Sized,
Converts a futures 0.1
Future<Item = T, Error = E>
into a futures 0.3
Future<Output = Result<T, E>>
.
use futures_util::compat::Future01CompatExt;
let future = futures_01::future::ok::<u32, ()>(1);
assert_eq!(future.compat().await, Ok(1));