| Crates.io | mono_event_derive |
| lib.rs | mono_event_derive |
| version | 0.6.0 |
| created_at | 2024-05-15 09:45:11.483397+00 |
| updated_at | 2024-05-22 07:11:11.205986+00 |
| description | Derive macros for mono_event |
| homepage | |
| repository | https://github.com/Bruce0203/mono_event |
| max_upload_size | |
| id | 1240825 |
| size | 7,587 |
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