Function futures::future::maybe_done[][src]

pub fn maybe_done<Fut>(future: Fut) -> MaybeDone<Fut> where
    Fut: Future

Wraps a future into a MaybeDone

Examples

#![feature(async_await, await_macro, futures_api, use_extern_macros, pin)]
use futures::{future, pin_mut};

let future = future::maybe_done(future::ready(5));
pin_mut!(future);
assert_eq!(future.reborrow().take_output(), None);
let () = await!(future.reborrow());
assert_eq!(future.reborrow().take_output(), Some(5));
assert_eq!(future.reborrow().take_output(), None);