| Crates.io | rx_core_subject_async |
| lib.rs | rx_core_subject_async |
| version | 0.2.0 |
| created_at | 2026-01-19 20:51:04.256174+00 |
| updated_at | 2026-01-24 15:10:59.910747+00 |
| description | async_subject for rx_core |
| homepage | https://github.com/AlexAegis/rx_bevy |
| repository | https://github.com/AlexAegis/rx_bevy |
| max_upload_size | |
| id | 2055330 |
| size | 16,393 |
Reduces observed values into one and emits it to active subscribers once completed. Once completed, it also replays the result to late subscribers.
N values and replays them to late subscribers.Run the example with:
cargo run -p rx_core --example subject_async_example
use rx_core::prelude::*;
fn main() {
let mut subject = AsyncSubject::<i32>::default();
let mut _subscription_1 = subject
.clone()
.subscribe(PrintObserver::<i32>::new("async_subject sub_1"));
subject.next(1);
subject.next(2);
let mut _subscription_2 = subject
.clone()
.subscribe(PrintObserver::<i32>::new("async_subject sub_2"));
subject.next(3);
subject.complete();
let mut _subscription_3 = subject
.clone()
.subscribe(PrintObserver::<i32>::new("async_subject sub_3"));
}
Output:
async_subject sub_1 - next: 3
async_subject sub_2 - next: 3
async_subject sub_1 - completed
async_subject sub_1 - unsubscribed
async_subject sub_2 - completed
async_subject sub_2 - unsubscribed
async_subject sub_3 - next: 3
async_subject sub_3 - completed
async_subject sub_3 - unsubscribed