pub trait Event:
Send
+ Sync
+ Debug
+ 'static {
// Provided methods
fn priority(&self) -> u32 { ... }
fn batchable(&self) -> bool { ... }
}Expand description
Trait for all IPC events.
Events are the primary communication mechanism between kernel subsystems, drivers, and modules. All events must be:
Send + Syncfor cross-thread dispatchDebugfor logging and diagnostics'staticfor type-erased storage
§Priority System
Events have a priority that affects handler dispatch order:
- 0-50: Core/critical handlers (run first)
- 100: Default priority
- 200+: Low priority (cleanup, logging)
Lower priority numbers mean earlier dispatch.
§Batching
Events can opt into batching for future optimization. When batchable()
returns true, the event bus may combine multiple events of the same type
into a single dispatch when under load.
§Targeted Events
For events that target specific components, implement TargetedEvent
in addition to Event. This allows using EventBus::subscribe_targeted()
for automatic filtering by target.