operator_find
Emit the first value that matches a predicate.
See Also
- FilterOperator - Keep values that satisfy a predicate.
- FindIndexOperator - Emit the index of the first value that matches a predicate.
- ElementAtOperator - Emit the value at the given index then complete.
- FirstOperator - Emit only the first value, then complete.
Example
cargo run -p rx_core --example operator_find_example
let _subscription = (1..=5)
.into_observable()
.find(|i| i % 2 == 0)
.subscribe(PrintObserver::new("find_operator"));
Output:
find_operator - next: 2
find_operator - completed
find_operator - unsubscribed