mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-29 06:26:22 +00:00
656 B
656 B
id | title |
---|---|
23599316-9c90-48cf-b77d-63b5ee1a8496 | ready |
Description
readcy1 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
.
Declaration
pub fn ready<T>() -> Ready<T>
Notable traits
impl<T> Future for Ready<T>
type Output = T;
Examples
use core::future;
let a = future::ready(1);
assert_eq!(a.await, 1);