From d5b313f388d424e60ae33ae58c1a65a65b24b8f1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 18:04:45 +0900 Subject: refactor(command): share Input/OutputInterface via Rc Convert InputInterface and OutputInterface parameters from &dyn/&mut dyn references to Rc> shared ownership across the command, console, and IO layers, matching the Phase C shared-ownership approach already used for IOInterface. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/plugin/command_event.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/plugin/command_event.rs') diff --git a/crates/shirabe/src/plugin/command_event.rs b/crates/shirabe/src/plugin/command_event.rs index bcfe256..838260c 100644 --- a/crates/shirabe/src/plugin/command_event.rs +++ b/crates/shirabe/src/plugin/command_event.rs @@ -10,25 +10,25 @@ use shirabe_php_shim::PhpMixed; pub struct CommandEvent { inner: Event, command_name: String, + input: std::rc::Rc>, + output: std::rc::Rc>, } impl CommandEvent { - // TODO(phase-b): input/output dropped because storing &dyn references in an event would - // require lifetime parameters; restore once Plugin API needs them. pub fn new( name: &str, command_name: &str, - _input: &dyn InputInterface, - _output: &dyn OutputInterface, + input: std::rc::Rc>, + output: std::rc::Rc>, ) -> Self { - Self::new6(name, command_name, _input, _output, vec![], IndexMap::new()) + Self::new6(name, command_name, input, output, vec![], IndexMap::new()) } pub fn new6( name: &str, command_name: &str, - _input: &dyn InputInterface, - _output: &dyn OutputInterface, + input: std::rc::Rc>, + output: std::rc::Rc>, args: Vec, flags: IndexMap, ) -> Self { @@ -36,9 +36,19 @@ impl CommandEvent { Self { inner, command_name: command_name.to_string(), + input, + output, } } + pub fn get_input(&self) -> std::rc::Rc> { + self.input.clone() + } + + pub fn get_output(&self) -> std::rc::Rc> { + self.output.clone() + } + pub fn get_name(&self) -> &str { self.inner.get_name() } -- cgit v1.3.1