pub trait TargetedEvent: Event {
// Required method
fn target(&self) -> &str;
}Expand description
Marker trait for events that target a specific component.
Events implementing this trait have a target field that specifies
which component should handle the event. This enables EventBus::subscribe_targeted()
to automatically filter events by target.
§Design Note
The kernel uses &str for target identifiers (mechanism), not ComponentId
(which is a policy-level type). Modules convert their identifiers to &str
when interacting with the kernel API.
§Example
use reovim_kernel::api::v1::*;
#[derive(Debug)]
struct PluginTextInput {
target: &'static str,
c: char,
}
impl Event for PluginTextInput {}
impl TargetedEvent for PluginTextInput {
fn target(&self) -> &str {
self.target
}
}