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