| Crates.io | rx_core_subject_publish |
| lib.rs | rx_core_subject_publish |
| version | 0.2.0 |
| created_at | 2026-01-19 20:44:24.44355+00 |
| updated_at | 2026-01-24 15:02:05.16285+00 |
| description | publish subject for rx_core |
| homepage | https://github.com/AlexAegis/rx_bevy |
| repository | https://github.com/AlexAegis/rx_bevy |
| max_upload_size | |
| id | 2055285 |
| size | 41,295 |
Forwards observed signals to all active subscribers. Does not replay values to late subscribers, but always replays terminal state.
N values and replays them to late subscribers.cargo run -p rx_core --example subject_publish_example
use rx_core::prelude::*;
fn main() {
let mut subject = PublishSubject::<i32>::default();
subject.next(1);
let mut subscription = subject
.clone()
.subscribe(PrintObserver::<i32>::new("subject_example"));
subject.next(2);
subject.next(3);
subscription.unsubscribe();
subject.next(4);
subject.complete();
let _subscription_2 = subject
.clone()
.subscribe(PrintObserver::<i32>::new("subject_example_2"));
}
Output:
subject_example - next: 2
subject_example - next: 3
subject_example - unsubscribed
subject_example_2 - completed
subject_example_2 - unsubscribed