Module futures_lite::future

source ·
Expand description

Combinators for the Future trait.

§Examples

use futures_lite::future;

for step in 0..3 {
    println!("step {}", step);

    // Give other tasks a chance to run.
    future::yield_now().await;
}

Re-exports§

Structs§

Traits§

Functions§

  • Blocks the current thread on a future.
  • Returns the result of the future that completes first, preferring future1 if both are ready.
  • Creates a future from a function returning Poll.
  • Polls a future just once and returns an Option with the result.
  • Returns the result of the future that completes first, with no preference if both are ready.
  • Race two futures but with a predefined random seed.
  • Joins two fallible futures, waiting for both to complete or one of them to error.
  • Wakes the current task and returns Poll::Pending once.
  • Joins two futures, waiting for both to complete.

Type Aliases§

  • Type alias for Pin<Box<dyn Future<Output = T> + Send + 'static>>.
  • Type alias for Pin<Box<dyn Future<Output = T> + 'static>>.