rx_core_observable_interval

Crates.iorx_core_observable_interval
lib.rsrx_core_observable_interval
version0.2.0
created_at2026-01-19 09:46:39.174151+00
updated_at2026-01-24 15:02:43.461112+00
descriptioninterval observable for rx_core
homepagehttps://github.com/AlexAegis/rx_bevy
repositoryhttps://github.com/AlexAegis/rx_bevy
max_upload_size
id2054152
size22,064
Sandor (AlexAegis)

documentation

https://github.com/AlexAegis/rx_bevy

README

observable_interval

crates.io ci codecov license

Emits a sequence of usize values every time the configured duration elapses.

See Also

Example

Run the example with:

cargo run -p rx_core --example observable_interval_example
let mut mock_executor = MockExecutor::new_with_logging();
let scheduler = mock_executor.get_scheduler_handle();

let mut interval_observable = IntervalObservable::new(
    IntervalObservableOptions {
        duration: Duration::from_secs(1),
        max_emissions_per_tick: 3,
        start_on_subscribe: true,
    },
    scheduler,
);
let _subscription = interval_observable.subscribe(PrintObserver::new("interval_observable"));

mock_executor.tick(Duration::from_millis(600));
mock_executor.tick(Duration::from_millis(401));
mock_executor.tick(Duration::from_millis(16200));
mock_executor.tick(Duration::from_millis(1200));
mock_executor.tick(Duration::from_millis(2200));

Output:

interval_observable - next: 0
Ticking... (600ms)
Ticking... (401ms)
interval_observable - next: 1
Ticking... (16.2s)
interval_observable - next: 2
interval_observable - next: 3
interval_observable - next: 4
Ticking... (1.2s)
interval_observable - next: 5
Ticking... (2.2s)
interval_observable - next: 6
interval_observable - next: 7
interval_observable - unsubscribed
Commit count: 652

cargo fmt