Function core::future::ready1.48.0[][src]

pub fn ready<T>(t: T) -> Ready<T>
Notable traits for Ready<T>
impl<T> Future for Ready<T> type Output = T;
Expand description

Creates a future that is immediately ready with a value.

Futures created through this function are functionally similar to those created through async {}. The main difference is that futures created through this function are named and implement Unpin.


use std::future;

let a = future::ready(1);
assert_eq!(a.await, 1);