pub fn map<T, U, S, F>(s: S, f: F) -> impl Stream<Item = U>Expand description
Maps each value in a stream using a function.
§Note
Prefer using the built-in StreamExt::map() method when chaining:
ⓘ
use futures::StreamExt;
let result = stream.map(|x| x * 2);For async mappers, use StreamExt::then():
ⓘ
let result = stream.then(|x| async move { x * 2 });This standalone function is provided for functional/pipe-style composition.