fn filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
    where
        F: FnMut(&Self::Item) -> Fut,
        Fut: Future<Output = bool>,
        Self: Sized,
    {
        assert_stream::<Self::Item, _>(Filter::new(self, f))
    }
/// Filters the values produced by this stream according to the provided
/// asynchronous predicate.
///
/// As values of this stream are made available, the provided predicate `f`
/// will be run against them. If the predicate returns a `Future` which
/// resolves to `true`, then the stream will yield the value, but if the
/// predicate returns a `Future` which resolves to `false`, then the value
/// will be discarded and 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` methods in the
/// standard library.
///
/// # Examples
///
/// ```
/// # futures::executor::block_on(async {
/// use futures::future;
/// use futures::stream::{self, StreamExt};
///
/// let stream = stream::iter(1..=10);
/// let events = stream.filter(|x| future::ready(x % 2 == 0));
///
/// assert_eq!(vec![2, 4, 6, 8, 10], events.collect::<Vec<_>>().await);
/// # });
/// ```
Filters the values produced by this stream according to the provided
asynchronous predicate.

As values of this stream are made available, the provided predicate `f`
will be run against them.

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.
Filters the values produced by this stream according to the provided asynchronous predicate . As values of this stream are made available the provided predicate ` f ` will be run against them . 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 filter<Fut, F>(self, f: F) -> Filter<Self, Fut, F>
    where
        F: FnMut(&Self::Item) -> Fut,
        Fut: Future<Output = bool>,
        Self: Sized,
    {
        assert_stream::<Self::Item, _>(Filter::new(self, f))
    }
fn filter < Fut , F > ( self , f : F ) -> Filter < Self , Fut , F > where F : FnMut ( & Self :: Item ) -> Fut , Fut : Future < Output = bool > , Self : Sized , { assert_stream :: < Self :: Item , _ > ( Filter :: new ( self , f ) ) }
Filters the values produced by this stream according to the provided
asynchronous predicate.
Filters the values produced by this stream according to the provided asynchronous predicate .
self
f
F
self
f
F
examples
None
futures::executor::block_on(async {
use futures::future;
use futures::stream::{self, StreamExt}.

let stream = stream::iter(1..=10);
let events = stream.filter(|x| future::ready(x % 2 == 0)).


use futures :: future ; use futures :: stream :: { self StreamExt } . let stream = stream :: iter ( 1 .. = 10 ) ; let events = stream . filter ( |x| future :: ready ( x % 2 == 0 )) .
});
None