| Crates.io | rx_core_operator_switch_map |
| lib.rs | rx_core_operator_switch_map |
| version | 0.2.0 |
| created_at | 2026-01-19 19:27:19.437606+00 |
| updated_at | 2026-01-24 15:10:17.79639+00 |
| description | switch_map operator for rx_core |
| homepage | https://github.com/AlexAegis/rx_bevy |
| repository | https://github.com/AlexAegis/rx_bevy |
| max_upload_size | |
| id | 2055150 |
| size | 21,942 |
Map each value to an inner observable and switch to the latest, unsubscribing previous ones.
cargo run -p rx_core --example operator_switch_map_operator_example
let _subscription = (1..=3)
.into_observable()
.switch_map(|next| IteratorObservable::new(1..=next), Never::map_into())
.subscribe(PrintObserver::new("switch_map"));
Output:
switch_map - next: 1
switch_map - next: 1
switch_map - next: 2
switch_map - next: 1
switch_map - next: 2
switch_map - next: 3
switch_map - completed
switch_map - unsubscribed