Function promising_future::any
[−]
[src]
pub fn any<T, I>(futures: I) -> Option<T> where I: IntoIterator<Item=Future<T>>, T: Send + 'static
Return first available Future
from an iterator of Future
s.
Given an iterator producing a stream of Future<T>
values, return the first resolved value.
All other values are discarded. Future
s which resolve without values are ignored.
Note 1: This lazily consumes the input iterator so it can be infinite. However each unresolved Future
takes memory so Future
s should resolve in bounded time (they need not resolve with values;
valueless Future
s are discarded).
Note 2: futures.into_iter()
should avoid blocking, as that will block this function even if
other Future
s resolve. (FIXME)