From 436e12381dd79e419dce755718be17b66d73e17f Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 9 Jun 2026 00:09:08 +0900 Subject: feat(event-dispatcher): unify event dispatch via EventInterface trait Extract a superclass-trait EventInterface from the base Event. pool_builder's PrePoolCreateEvent stays deferred: its constructor needs owned, non-cloneable Request and repository boxes the builder only holds by reference (owned-payload blocker). The event is plugin-only, so its construction is re-tagged TODO(plugin). Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/plugin/pre_command_run_event.rs | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'crates/shirabe/src/plugin/pre_command_run_event.rs') diff --git a/crates/shirabe/src/plugin/pre_command_run_event.rs b/crates/shirabe/src/plugin/pre_command_run_event.rs index 29567cb..854c47f 100644 --- a/crates/shirabe/src/plugin/pre_command_run_event.rs +++ b/crates/shirabe/src/plugin/pre_command_run_event.rs @@ -2,7 +2,10 @@ // TODO(plugin): this event is part of the plugin API and is dispatched before a command runs use crate::event_dispatcher::Event; +use crate::event_dispatcher::EventInterface; +use indexmap::IndexMap; use shirabe_external_packages::symfony::console::input::InputInterface; +use shirabe_php_shim::PhpMixed; #[derive(Debug)] pub struct PreCommandRunEvent { @@ -37,3 +40,25 @@ impl PreCommandRunEvent { &self.command } } + +impl EventInterface for PreCommandRunEvent { + fn get_name(&self) -> &str { + self.inner.get_name() + } + + fn get_arguments(&self) -> &Vec { + self.inner.get_arguments() + } + + fn get_flags(&self) -> &IndexMap { + self.inner.get_flags() + } + + fn is_propagation_stopped(&self) -> bool { + self.inner.is_propagation_stopped() + } + + fn stop_propagation(&mut self) { + self.inner.stop_propagation(); + } +} -- cgit v1.3.1