fn try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>
    where
        Fut: TryFuture<Ok = Option<T>, Error = Self::Error>,
        F: FnMut(Self::Ok) -> Fut,
        Self: Sized,
    {
        assert_stream::<Result<T, Self::Error>, _>(TryFilterMap::new(self, f))
    }
/// Attempt to filter 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.
///
/// All errors are passed through without filtering in this combinator.
///
/// 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, TryStreamExt};
/// use futures::pin_mut;
///
/// let stream = stream::iter(vec![Ok(1i32), Ok(6i32), Err("error")]);
/// let halves = stream.try_filter_map(|x| async move {
///     let ret = if x % 2 == 0 { Some(x / 2) } else { None };
///     Ok(ret)
/// });
///
/// pin_mut!(halves);
/// assert_eq!(halves.next().await, Some(Ok(3)));
/// assert_eq!(halves.next().await, Some(Err("error")));
/// # })
/// ```
Attempt to filter 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.

All errors are passed through without filtering in this combinator.

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.
Attempt to filter 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 . All errors are passed through without filtering in this combinator . 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 try_filter_map<Fut, F, T>(self, f: F) -> TryFilterMap<Self, Fut, F>
    where
        Fut: TryFuture<Ok = Option<T>, Error = Self::Error>,
        F: FnMut(Self::Ok) -> Fut,
        Self: Sized,
    {
        assert_stream::<Result<T, Self::Error>, _>(TryFilterMap::new(self, f))
    }
fn try_filter_map < Fut , F , T > ( self , f : F ) -> TryFilterMap < Self , Fut , F > where Fut : TryFuture < Ok = Option < T > , Error = Self :: Error > , F : FnMut ( Self :: Ok ) -> Fut , Self : Sized , { assert_stream :: < Result < T , Self :: Error > , _ > ( TryFilterMap :: new ( self , f ) ) }
Attempt to filter the values produced by this stream while
simultaneously mapping them to a different type according to the
provided asynchronous closure.
Attempt to filter 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, TryStreamExt};
use futures::pin_mut.

let stream = stream::iter(vec![Ok(1i32), Ok(6i32), Err("error")]);
let halves = stream.try_filter_map(|x| async move {
let ret = if x % 2 == 0 { Some(x / 2) } else { None };
Ok(ret)
}).

pin_mut!(halves);
assert_eq!(halves.next().await, Some(Ok(3)));
assert_eq!(halves.next().await, Some(Err("error"))).
use futures :: stream :: { self StreamExt TryStreamExt } ; use futures :: pin_mut . let stream = stream :: iter ( vec! [ Ok ( 1i32 ) Ok ( 6i32 ) Err ( " error " ) ] ) ; let halves = stream . try_filter_map ( |x| async move { let ret = if x % 2 == 0 { Some ( x / 2 ) } else { None } ; Ok ( ret ) } ) . pin_mut! ( halves ) ; assert_eq! ( halves . next () . await Some ( Ok ( 3 ))) ; assert_eq! ( halves . next () . await Some ( Err ( " error " ))) .
})
None