| Crates.io | rx_core_observable_combine_changes |
| lib.rs | rx_core_observable_combine_changes |
| version | 0.2.0 |
| created_at | 2026-01-19 07:39:25.172151+00 |
| updated_at | 2026-01-24 15:01:16.872346+00 |
| description | combine_changes observable for rx_core |
| homepage | https://github.com/AlexAegis/rx_bevy |
| repository | https://github.com/AlexAegis/rx_bevy |
| max_upload_size | |
| id | 2053959 |
| size | 18,669 |
The CombineChangesObservable subscribes to two input observables, and emits
when either of them emit, even if the other haven't emitted yet.
It wraps downstream signals into the Change<T> enum, where a value is either:
JustUpdated - When this value's changed caused the emission.Latest - When this value did not change since the last emission.None - When this observable have not emitted yet.cargo run -p rx_core --example observable_combine_changes_example
let mut greetings_subject = PublishSubject::<&'static str>::default();
let mut count_subject = PublishSubject::<usize>::default();
let mut subscription = combine_changes(greetings_subject.clone(), count_subject.clone())
.subscribe(PrintObserver::new("combine_changes"));
greetings_subject.next("Hello!");
count_subject.next(10);
count_subject.next(20);
greetings_subject.next("Szia!");
greetings_subject.complete();
count_subject.next(30);
count_subject.complete();
subscription.unsubscribe();
Output:
combine_changes - next: (JustUpdated("Hello!"), None)
combine_changes - next: (Latest("Hello!"), JustUpdated(10))
combine_changes - next: (Latest("Hello!"), JustUpdated(20))
combine_changes - next: (JustUpdated("Szia!"), Latest(20))
combine_changes - next: (Latest("Szia!"), JustUpdated(30))
combine_changes - completed
combine_changes - unsubscribed