operator_pairwise
Emit the previous and current values together.
See Also
- MapOperator - Transform each value with a mapping function.
- MapIntoOperator -
Map each value using
Into. - MapErrorOperator - Transform error values into another error value.
- MapNeverOperator -
Re-type
Neversignals into concrete types. - MaterializeOperator - Turn next/error/complete into notification values.
- DematerializeOperator - Convert notifications back into real signals.
- EnumerateOperator - Attach a running index to each emission.
Example
cargo run -p rx_core --example operator_pairwise_example
let _subscription = (1..=4)
.into_observable()
.pairwise()
.subscribe(PrintObserver::new("pairwise_operator"));
Output:
pairwise_operator - next: [1, 2]
pairwise_operator - next: [2, 3]
pairwise_operator - next: [3, 4]
pairwise_operator - completed
pairwise_operator - unsubscribed