rx_core_operator_tap

Crates.iorx_core_operator_tap
lib.rsrx_core_operator_tap
version0.2.0
created_at2026-01-19 19:43:28.242525+00
updated_at2026-01-24 15:10:31.951405+00
descriptiontap next operator for rx_core, for the simple use cases where you don't want to define an entire observable to peek into one.
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2055163
size15,933
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

operator_tap

crates.io ci codecov license

Book Page - Operator Source - Subscriber Source

The tap operator lets you forward upstream values to a destination observer.

The destination could be anything, a PrintObserver to log upstream values to the console, or even a subject to trigger another pipeline.

Good to know

  • Keep in mind that the destination observer passed in will not get upgraded1, meaning a tap operator will never call unsubscribe on the destination, even if it's a subscriber that upgrades to itself and has an unsubscribe implementation. However, the error and complete signals are forwarded. If you want to avoid forwarding error and complete, use tap_next instead.

See Also

  • TapNextOperator - Run a callback for each next value while letting signals pass through.
  • OnNextOperator - Invoke a callback for each value that can also decide whether to forward it.
  • OnSubscribeOperator - Run a callback when a subscription is established.
  • FinalizeOperator - Execute cleanup when the observable finishes or unsubscribes.

Example

cargo run -p rx_core --example operator_tap_example
(1..=3)
    .into_observable()
    .tap(PrintObserver::new("tap_destination"))
    .subscribe(PrintObserver::new("tap_operator"));

Output:

tap_destination - next: 1
tap_operator - next: 1
tap_destination - next: 2
tap_operator - next: 2
tap_destination - next: 3
tap_operator - next: 3
tap_destination - completed
tap_operator - completed
tap_operator - unsubscribed

Footnotes

  1. Documentation on UpgradeableObserver

Commit count: 652

cargo fmt