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_map

crates.io ci codecov license

Map values to an Option and keep only the Some values.

See Also

Example

cargo run -p rx_core --example operator_filter_map_example
let _subscription = (1..=5)
    .into_observable()
    .filter_map(|i| if i % 2 == 0 { Some(i) } else { None })
    .subscribe(PrintObserver::new("filter_map_operator"));

Output:

filter_map_operator - next: 2
filter_map_operator - next: 4
filter_map_operator - completed
filter_map_operator - unsubscribed