2 releases
0.1.1 | Jul 5, 2024 |
---|---|
0.1.0 | Jul 5, 2024 |
#395 in Operating systems
3KB
Simple Signal
A dead simple signal system implementation.
Example
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);
}