obkrnl/event/ty.rs
1use crate::subsystem::Subsystem;
2use alloc::boxed::Box;
3use alloc::sync::Arc;
4
5/// Type of an event.
6pub trait EventType: 'static {
7 type Handler<S: Subsystem>;
8 type Wrapper: Send + Sync + 'static;
9}
10
11impl<A: 'static> EventType for fn(&A) {
12 type Handler<S: Subsystem> = fn(&Arc<S>, &A);
13 type Wrapper = Box<dyn Fn(&A) + Send + Sync>;
14}
15
16impl<A: 'static> EventType for fn(&mut A) {
17 type Handler<S: Subsystem> = fn(&Arc<S>, &mut A);
18 type Wrapper = Box<dyn Fn(&mut A) + Send + Sync>;
19}