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

#14 in #mono


Used in mono_event

MIT license

8KB
157 lines

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

~270–730KB
~17K SLoC