[][src]Function futures_util::future::err

pub fn err<T, E>(err: E) -> Ready<Result<T, E>>

Create a future that is immediately ready with an error value.

Examples

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

let a = future::err::<i32, i32>(1);
assert_eq!(await!(a), Err(1));