rx_core_operator_on_next

Crates.iorx_core_operator_on_next
lib.rsrx_core_operator_on_next
version0.2.0
created_at2026-01-19 17:43:57.566495+00
updated_at2026-01-24 15:08:51.786438+00
descriptionon_next operator for rx_core
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2055021
size15,072
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

operator_on_next

crates.io ci codecov license

Invoke a callback for each value that can also decide whether to forward it.

  • Returning true allows the value to be forwarded to the destination observer.
  • Returning false prevents the value from being forwarded.

Like filter, but with access to the destination observer!

See Also

Example

cargo run -p rx_core --example operator_on_next_example
let _subscription = (1..=5)
    .into_observable()
    .on_next(|next, destination| {
        destination.next(next * 99);
        true
    })
    .subscribe(PrintObserver::new("on_next_operator"));

Output:

on_next_operator - next: 99
on_next_operator - next: 1
on_next_operator - next: 198
on_next_operator - next: 2
on_next_operator - next: 297
on_next_operator - next: 3
on_next_operator - next: 396
on_next_operator - next: 4
on_next_operator - next: 495
on_next_operator - next: 5
on_next_operator - completed
on_next_operator - unsubscribed
Commit count: 652

cargo fmt