Function async_ops::assignable[][src]

pub fn assignable<'a, Fut: Future + Send + 'a>(
    future: Fut
) -> Async<BoxFuture<'a, Fut::Output>>
Notable traits for Async<Fut>
impl<Fut: Future> Future for Async<Fut> type Output = Fut::Output;
Expand description

Wraps the given Future with Async that can be used with the Assign variants of std::ops traits.

See also Async::assignable.

Example

use futures::executor::block_on;

let a = async { 40 };
let b = async { 2 };

let result = async {
  let mut a = async_ops::assignable(a);
  a += b;
  a.await
};

assert_eq!(42, block_on(result));