fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
    where
        F: FnMut(Self::Item) -> Fut,
        Fut: Future<Output = Option<T>>,
        Self: Sized,
    {
        assert_stream::<T, _>(FilterMap::new(self, f))
    }
/// Filters the values produced by this stream while simultaneously mapping
/// them to a different type according to the provided asynchronous closure.
///
/// As values of this stream are made available, the provided function will
/// be run on them. If the future returned by the predicate `f` resolves to
/// [`Some(item)`](Some) then the stream will yield the value `item`, but if
/// it resolves to [`None`] then the next value will be produced.
///
/// Note that this function consumes the stream passed into it and returns a
/// wrapped version of it, similar to the existing `filter_map` methods in
/// the standard library.
///
/// # Examples
/// ```
/// # futures::executor::block_on(async {
/// use futures::stream::{self, StreamExt};
///
/// let stream = stream::iter(1..=10);
/// let events = stream.filter_map(|x| async move {
///     if x % 2 == 0 { Some(x + 1) } else { None }
/// });
///
/// assert_eq!(vec![3, 5, 7, 9, 11], events.collect::<Vec<_>>().await);
/// # });
/// ```
Filters the values produced by this stream while simultaneously mapping
them to a different type according to the provided asynchronous closure.

As values of this stream are made available, the provided function will
be run on them.

Note that this function consumes the stream passed into it and returns a
wrapped version of it, similar to the existing `filter_map` methods in
the standard library.
Filters the values produced by this stream while simultaneously mapping them to a different type according to the provided asynchronous closure . As values of this stream are made available the provided function will be run on them . Note that this function consumes the stream passed into it and returns a wrapped version of it similar to the existing ` filter_map ` methods in the standard library .
fn filter_map<Fut, T, F>(self, f: F) -> FilterMap<Self, Fut, F>
    where
        F: FnMut(Self::Item) -> Fut,
        Fut: Future<Output = Option<T>>,
        Self: Sized,
    {
        assert_stream::<T, _>(FilterMap::new(self, f))
    }
fn filter_map < Fut , T , F > ( self , f : F ) -> FilterMap < Self , Fut , F > where F : FnMut ( Self :: Item ) -> Fut , Fut : Future < Output = Option < T > > , Self : Sized , { assert_stream :: < T , _ > ( FilterMap :: new ( self , f ) ) }
Filters the values produced by this stream while simultaneously mapping
them to a different type according to the provided asynchronous closure.
Filters the values produced by this stream while simultaneously mapping them to a different type according to the provided asynchronous closure .
self
f
F
self
f
F
examples
None
futures::executor::block_on(async {
use futures::stream::{self, StreamExt}.

let stream = stream::iter(1..=10);
let events = stream.filter_map(|x| async move {
if x % 2 == 0 { Some(x + 1) } else { None }
}).


use futures :: stream :: { self StreamExt } . let stream = stream :: iter ( 1 .. = 10 ) ; let events = stream . filter_map ( |x| async move { if x % 2 == 0 { Some ( x + 1 ) } else { None } } ) .
});
None