pub trait EventSubscriber: Send + Sync {
// Required methods
fn event_name(&self) -> &'static str;
fn handle(&self, event: &dyn Event) -> Result<(), EventError>;
// Provided method
fn priority(&self) -> i32 { ... }
}Expand description
Handles events of one name. Higher Self::priority runs first.
Required Methods§
Sourcefn event_name(&self) -> &'static str
fn event_name(&self) -> &'static str
Event name this subscriber listens to.
Sourcefn handle(&self, event: &dyn Event) -> Result<(), EventError>
fn handle(&self, event: &dyn Event) -> Result<(), EventError>
Handles a matching event.
§Errors
Return EventError when handling fails. Remaining subscribers still run.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".