Skip to main content

from_fn

Function from_fn 

Source
pub fn from_fn<T, F, Fut>(f: F) -> impl Stream<Item = T> + Send + 'static
where T: Send + 'static, F: FnMut() -> Fut + Send + 'static, Fut: Future<Output = Option<T>> + Send + 'static,
Expand description

Create a lazy stream from an async generator function.

f is called repeatedly; it should return Some(item) while there are items, and None to terminate.