[−][src]Crate futures_race
A way to poll two futures and get the output of the first one to complete.
Example
use futures_race::{Race, RaceExt}; use smol::Timer; use std::time::Duration; smol::run(async { let foo = async { Timer::new(Duration::from_millis(100)).await; 42 }; let bar = async { Timer::new(Duration::from_millis(250)).await; 24 }; let foobar = foo.race(bar).await; assert_eq!(foobar, 42); });
Structs
Race | A future polling two other futures and returning the output of the first one to complete. |
Traits
RaceExt | An extension trait for |