2 releases
0.1.1 | Jul 11, 2024 |
---|---|
0.1.0 | May 9, 2023 |
#73 in No standard library
1,727 downloads per month
4KB
handler_table
A lock-free table of event handlers.
Examples
use handler_table::HandlerTable;
static TABLE: HandlerTable<8> = HandlerTable::new();
TABLE.register_handler(0, || {
println!("Hello, event 0!");
});
TABLE.register_handler(1, || {
println!("Hello, event 1!");
});
assert!(TABLE.handle(0)); // print "Hello, event 0!"
assert!(!TABLE.handle(2)); // unregistered