Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

observable_join

crates.io ci codecov license

Emits the latest values from both inputs once both complete.

This observable will only emit once both of its input observables have completed. After which it will emit a tuple of the last emissions from each input observable, then complete.

Meaning if even one of the observables haven’t emitted before all of them had completed, only a complete notification will be observed!

If not all observables complete, nothing will be emitted even if all input observables were primed.

See Also

  • CombineChangesObservable - Emits the latest of two sources, tagging which side changed, even before both have emitted.
  • CombineLatestObservable - Emits the latest of two sources whenever either emits, after both emitted at least once.
  • ZipObservable - Emits paired tuples when both sources emit, matched by emission order.

Example

cargo run -p rx_core --example observable_join_example
let observable_1 = (1..=3).into_observable();
let observable_2 = (4..=6).into_observable();

let _subscription = join(observable_1, observable_2).subscribe(PrintObserver::new("join"));

Output:

join - next: (3, 6)
join - completed
join - unsubscribed