mono_event_derive

Crates.iomono_event_derive
lib.rsmono_event_derive
version0.6.0
sourcesrc
created_at2024-05-15 09:45:11.483397
updated_at2024-05-22 07:11:11.205986
descriptionDerive macros for mono_event
homepage
repositoryhttps://github.com/Bruce0203/mono_event
max_upload_size
id1240825
size7,587
(Bruce0203)

documentation

README

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
Commit count: 22

cargo fmt