flâneur — a map of the web's best reading

Future in std::future - Rust

doc.rust-lang.org · 954 words · saved by 1 readers

A future is a value that might not have finished computing yet. This kind of “asynchronous value” makes it possible for a thread to continue doing useful work while it waits for the value to become available. The core method of future, poll, attempts to resolve the future into a final value. This method does not block if the value is not ready. Instead, the current task is scheduled to be woken up when it’s possible to make further progress by polling again. The context passed to the poll method can provide a Waker, which is a handle for waking up the current task. When using a future, you generally won’t call poll directly, but instead .await the value. The type of value produced on completion. Attempt to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. This function returns: Once a future has finished, clients should not poll it again. When a future is not ready yet, poll returns Poll::Pending and stores a clone of the Wa

Future in std::future - Rust Skip to main content This old browser is unsupported and will most likely display funky things. Future std :: future Trait Future Copy item path 1.36.0 · Source pub trait Future { type Output ; // Required method fn poll (self: Pin <&mut Self>, cx: &mut Context <'_>) -> Poll <Self:: Output >; } Expand description A future represents an asynchronous computation, commonly obtained by use of async . A future is a value that might not have finished computing yet. This kind of “asynchronous value” makes it possible for a thread to continue doing useful work while it wai

Explore this link on the map →

related reading