rx_core_operator_switch_map

Crates.iorx_core_operator_switch_map
lib.rsrx_core_operator_switch_map
version0.2.0
created_at2026-01-19 19:27:19.437606+00
updated_at2026-01-24 15:10:17.79639+00
descriptionswitch_map operator for rx_core
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2055150
size21,942
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

operator_switch_map

crates.io ci codecov license

Map each value to an inner observable and switch to the latest, unsubscribing previous ones.

See Also

  • ConcatAllOperator - Subscribes to upstream observables one at a time in order.
  • MergeAllOperator - Subscribes to upstream observables and merges their emissions concurrently.
  • SwitchAllOperator - Switch to the newest inner observable, unsubscribing previous ones.
  • ExhaustAllOperator - Ignore new inner observables while one is active.
  • ConcatMapOperator - Map each value to an inner observable and subscribe to them one at a time in order.
  • MergeMapOperator - Map each value to an inner observable and merge their emissions concurrently.
  • ExhaustMapOperator - Map each value to an inner observable and ignore new ones while one is active.

Example

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
Commit count: 652

cargo fmt