On this page
Function std::future::ready
pub fn ready<T>(t: T) -> Ready<T> ⓘ
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
.
Examples
use std::future;
let a = future::ready(1);
assert_eq!(a.await, 1);
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/future/fn.ready.html