[][src]Function futures_util::future::maybe_done

Important traits for MaybeDone<Fut>
pub fn maybe_done<Fut: Future>(future: Fut) -> MaybeDone<Fut>

Wraps a future into a MaybeDone

Examples

#![feature(async_await, await_macro, futures_api)]
use futures::future;
use pin_utils::pin_mut;

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