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

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

Notable traits for MaybeDone<Fut>

impl<Fut> Future for MaybeDone<Fut> where
    Fut: Future
type Output = ();
where
    Fut: Future

Wraps a future into a MaybeDone

Examples

use futures::future;
use futures::pin_mut;

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