fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>
    where
        Fut: Future<Output = bool>,
        F: FnMut(&Self::Ok) -> Fut,
        Self: Sized,
    {
        assert_stream::<Result<Self::Ok, Self::Error>, _>(TryFilter::new(self, f))
    }
/// Attempt to filter the values produced by this stream according to the
/// provided asynchronous closure.
///
/// As values of this stream are made available, the provided predicate `f`
/// will be run on them. If the predicate returns a `Future` which resolves
/// to `true`, then the stream will yield the value, but if the predicate
/// return a `Future` which resolves to `false`, then the value will be
/// discarded and 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` methods in
/// the standard library.
///
/// # Examples
/// ```
/// # futures::executor::block_on(async {
/// use futures::future;
/// use futures::stream::{self, StreamExt, TryStreamExt};
///
/// let stream = stream::iter(vec![Ok(1i32), Ok(2i32), Ok(3i32), Err("error")]);
/// let mut evens = stream.try_filter(|x| {
///     future::ready(x % 2 == 0)
/// });
///
/// assert_eq!(evens.next().await, Some(Ok(2)));
/// assert_eq!(evens.next().await, Some(Err("error")));
/// # })
/// ```
Attempt to filter the values produced by this stream according to the
provided asynchronous closure.

As values of this stream are made available, the provided predicate `f`
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` methods in
the standard library.
Attempt to filter the values produced by this stream according to the provided asynchronous closure . As values of this stream are made available the provided predicate ` f ` 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 ` methods in the standard library .
fn try_filter<Fut, F>(self, f: F) -> TryFilter<Self, Fut, F>
    where
        Fut: Future<Output = bool>,
        F: FnMut(&Self::Ok) -> Fut,
        Self: Sized,
    {
        assert_stream::<Result<Self::Ok, Self::Error>, _>(TryFilter::new(self, f))
    }
fn try_filter < Fut , F > ( self , f : F ) -> TryFilter < Self , Fut , F > where Fut : Future < Output = bool > , F : FnMut ( & Self :: Ok ) -> Fut , Self : Sized , { assert_stream :: < Result < Self :: Ok , Self :: Error > , _ > ( TryFilter :: new ( self , f ) ) }
Attempt to filter the values produced by this stream according to the
provided asynchronous closure.
Attempt to filter the values produced by this stream according to the provided asynchronous closure .
self
f
F
self
f
F
examples
None
futures::executor::block_on(async {
use futures::future;
use futures::stream::{self, StreamExt, TryStreamExt}.



assert_eq!(evens.next().await, Some(Ok(2)));
assert_eq!(evens.next().await, Some(Err("error"))).
use futures :: future ; use futures :: stream :: { self StreamExt TryStreamExt } . assert_eq! ( evens . next () . await Some ( Ok ( 2 ))) ; assert_eq! ( evens . next () . await Some ( Err ( " error " ))) .
})
None