simplesignal

Crates.iosimplesignal
lib.rssimplesignal
version0.1.1
sourcesrc
created_at2024-07-05 21:25:55.77051
updated_at2024-07-05 21:27:03.877649
descriptionA dead simple signal system implementation
homepage
repository
max_upload_size
id1293409
size2,895
blinx (gosulja)

documentation

README

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);
}
Commit count: 0

cargo fmt