futures::future

Function result

Source
pub fn result<T, E>(r: Result<T, E>) -> FutureResult<T, E>
Expand description

Creates a new future that will immediate resolve with the given result.

ยงExamples

use futures_core::future::*;

let future_of_1 = result::<u32, u32>(Ok(1));
let future_of_err_2 = result::<u32, u32>(Err(2));