operator_map_error
Transform error values into another error value.
See Also
- MapOperator - Transform each value with a mapping function.
- MapIntoOperator -
Map each value using
Into. - 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.
- PairwiseOperator - Emit the previous and current values together.
Example
cargo run -p rx_core --example operator_map_error_example
let _subscription = concat((
(1..=5)
.into_observable()
.map_error(Never::map_into::<&'static str>()),
throw("error").map(Never::map_into::<usize>()),
))
.skip(1)
.map_error(|error| format!("error? {error}"))
.subscribe(PrintObserver::new("map_error_operator"));
Output:
map_error_operator - next: 1
map_error_operator - next: 2
map_error_operator - next: 3
map_error_operator - next: 4
map_error_operator - next: 5
map_error_operator - error: "error? error"
map_error_operator - unsubscribed