diff options
Diffstat (limited to 'crates/shirabe/src/event_dispatcher/event.rs')
| -rw-r--r-- | crates/shirabe/src/event_dispatcher/event.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/shirabe/src/event_dispatcher/event.rs b/crates/shirabe/src/event_dispatcher/event.rs index f04839f6..7075ada0 100644 --- a/crates/shirabe/src/event_dispatcher/event.rs +++ b/crates/shirabe/src/event_dispatcher/event.rs @@ -47,6 +47,9 @@ impl Event { } pub trait EventInterface: std::fmt::Debug { + /// For downcasting to the concrete event type (PHP `instanceof`), mirroring + /// `IOInterface::as_any`. + fn as_any(&self) -> &dyn std::any::Any; fn get_name(&self) -> &str; fn get_arguments(&self) -> &Vec<String>; fn get_flags(&self) -> &IndexMap<String, PhpMixed>; @@ -55,6 +58,10 @@ pub trait EventInterface: std::fmt::Debug { } impl EventInterface for Event { + fn as_any(&self) -> &dyn std::any::Any { + self + } + fn get_name(&self) -> &str { &self.name } |
