Type Alias unicycle::FuturesUnordered
source · pub type FuturesUnordered<T> = Unordered<T, Futures>;
Expand description
A container for an unordered collection of Futures.
§Examples
use tokio::time;
use std::time::Duration;
#[tokio::main]
async fn main() {
let mut futures = unicycle::FuturesUnordered::new();
futures.push(time::sleep(Duration::from_secs(2)));
futures.push(time::sleep(Duration::from_secs(3)));
futures.push(time::sleep(Duration::from_secs(1)));
while let Some(_) = futures.next().await {
println!("tick");
}
println!("done!");
}
Aliased Type§
struct FuturesUnordered<T> { /* private fields */ }
Implementations§
source§impl<T> FuturesUnordered<T>
impl<T> FuturesUnordered<T>
sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new, empty FuturesUnordered.
§Examples
use unicycle::FuturesUnordered;
let mut futures = FuturesUnordered::new();
assert!(futures.is_empty());
futures.push(async { 42 });
Trait Implementations§
source§impl<T> FromIterator<T> for FuturesUnordered<T>where
T: Future,
impl<T> FromIterator<T> for FuturesUnordered<T>where
T: Future,
source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Creates a value from an iterator. Read more