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

#9 in #mono

Download history 12/week @ 2024-09-21

223 downloads per month

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–720KB
~17K SLoC