Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

operator_filter

crates.io ci codecov license

Keep values that satisfy a predicate.

See Also

Example

cargo run -p rx_core --example operator_filter_example
let _subscription = (1..=5)
    .into_observable()
    .map(|next: i32| next + 1)
    .filter(|i, _| i > &2)
    .subscribe(PrintObserver::new("filter_operator"));

Output:

filter_operator - next: 3
filter_operator - next: 4
filter_operator - next: 5
filter_operator - next: 6
filter_operator - completed
filter_operator - unsubscribed