operator_lift_option
Filter out None and forward Some values.
See Also
- FilterOperator - Keep values that satisfy a predicate.
- FilterMapOperator -
Map values to an
Optionand keep only theSomevalues. - TakeOperator -
Emit only the first
nvalues, then complete. - SkipOperator -
Drop the first
nvalues.
Example
cargo run -p rx_core --example operator_lift_option_example
let _subscription = (1..=5)
.into_observable()
.map(|i| if i % 2 == 0 { Some(i) } else { None })
.lift_option()
.subscribe(PrintObserver::new("lift_option_operator"));
Output:
lift_option_operator - next: 2
lift_option_operator - next: 4
lift_option_operator - completed
lift_option_operator - unsubscribed