Crates.io | simplesignal |
lib.rs | simplesignal |
version | 0.1.1 |
source | src |
created_at | 2024-07-05 21:25:55.77051 |
updated_at | 2024-07-05 21:27:03.877649 |
description | A dead simple signal system implementation |
homepage | |
repository | |
max_upload_size | |
id | 1293409 |
size | 2,895 |
A dead simple signal system implementation.
fn main() {
let mut signal = Signal::<i32>::new();
let _id1 = signal.subscribe(|value| println!("Subscriber 1 received: {}", value));
let id2 = signal.subscribe(|value| println!("Subscriber 2 received: {}", value));
signal.call(&10);
signal.unsubscribe(id2);
signal.call(&20);
signal.cleanup();
signal.call(&30);
signal.subscribe(|value| println!("New subscriber received: {}", value));
signal.call(&40);
}