#events #event-system #mono #listen #super

nightly mono_event

super fast event system

6 releases (breaking)

0.6.0 May 22, 2024
0.5.0 May 22, 2024
0.4.0 May 18, 2024
0.3.0 May 15, 2024
0.1.0 May 15, 2024

#10 in #mono

MIT license

4KB

mono event

This library is nightly-only as it relies on specialization

#![feature(min_specialization)]

use mono_event::{event, highest_priority, listen, low_priority};

#[test]
fn example() {
    SayHi.dispatch().unwrap();
}

#[event]
pub struct SayHi;

#[highest_priority]
#[listen(SayHi)]
fn print_hi(event: &mut SayHi) {
    println!("say hi");
}

#[low_priority]
#[listen(SayHi)]
fn print_hmm(event: &mut SayHi) {
    println!("say hmm..");
}

output:
say hmm..
say hi

Dependencies

~255–710KB
~16K SLoC