rx_core_operator_subscribe_on

Crates.iorx_core_operator_subscribe_on
lib.rsrx_core_operator_subscribe_on
version0.2.0
created_at2026-01-22 19:43:32.309628+00
updated_at2026-01-24 15:09:58.40678+00
descriptionsubscribe_on operator for rx_core
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2062453
size17,197
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

operator_subscribe_on

crates.io ci codecov license

The subscribe_on operator schedules the subscription to the upstream observable on the provided scheduler.

This only affects when the upstream subscription starts. It does not alter when upstream next, error, or complete signals are emitted.

The subscription can be delayed with subscribe_on_with_delay.

See Also

  • ObserveOnOperator - Re-emit upstream signals with the provided scheduler.
  • DelayOperator - Shift emissions forward in time using the scheduler.
  • RetryOperator - Resubscribe on error up to the configured retry count.

Example

cargo run -p rx_core --example operator_subscribe_on_example
use std::time::Duration;

use rx_core::prelude::*;
use rx_core_testing::MockExecutor;

fn main() {
    let mut executor = MockExecutor::new_with_logging();
    let scheduler = executor.get_scheduler_handle();

    let _subscription = (1..=3)
        .into_observable()
      .subscribe_on(scheduler)
        .subscribe(PrintObserver::new("subscribe_on_operator"));

    executor.tick(Duration::from_millis(0));
}

Output:

Ticking... (0ns)
subscribe_on_operator - next: 1
subscribe_on_operator - next: 2
subscribe_on_operator - next: 3
subscribe_on_operator - completed
subscribe_on_operator - unsubscribed
Commit count: 652

cargo fmt