From f411daceacad66e0bd774fda7d3c5ef8533cc55c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Tue, 26 May 2026 20:04:02 +0900 Subject: refactor(io): share IOInterface via Rc> handle Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/io/buffer_io.rs | 52 ++++++++++++++------------------------ 1 file changed, 19 insertions(+), 33 deletions(-) (limited to 'crates/shirabe/src/io/buffer_io.rs') diff --git a/crates/shirabe/src/io/buffer_io.rs b/crates/shirabe/src/io/buffer_io.rs index 867eb0e..ed87b71 100644 --- a/crates/shirabe/src/io/buffer_io.rs +++ b/crates/shirabe/src/io/buffer_io.rs @@ -129,39 +129,9 @@ impl BufferIO { } } -// TODO(phase-b): PHP `class BufferIO extends ConsoleIO` — delegate all IOInterface, -// LoggerInterface, and BaseIO methods to `self.inner` (ConsoleIO). -impl shirabe_external_packages::psr::log::LoggerInterface for BufferIO { - fn emergency(&self, message: &str, context: &[(&str, &str)]) { - self.inner.emergency(message, context) - } - fn alert(&self, message: &str, context: &[(&str, &str)]) { - self.inner.alert(message, context) - } - fn critical(&self, message: &str, context: &[(&str, &str)]) { - self.inner.critical(message, context) - } - fn error(&self, message: &str, context: &[(&str, &str)]) { - self.inner.error(message, context) - } - fn warning(&self, message: &str, context: &[(&str, &str)]) { - self.inner.warning(message, context) - } - fn notice(&self, message: &str, context: &[(&str, &str)]) { - self.inner.notice(message, context) - } - fn info(&self, message: &str, context: &[(&str, &str)]) { - self.inner.info(message, context) - } - fn debug(&self, message: &str, context: &[(&str, &str)]) { - self.inner.debug(message, context) - } - fn log(&self, level: &str, message: &str, context: &[(&str, &str)]) { - self.inner.log(level, message, context) - } -} - -impl crate::io::IOInterface for BufferIO { +// TODO(phase-b): PHP `class BufferIO extends ConsoleIO` — delegate all +// IOInterface and BaseIO methods to `self.inner` (ConsoleIO). +impl crate::io::IOInterfaceImmutable for BufferIO { fn is_interactive(&self) -> bool { self.inner.is_interactive() } @@ -247,6 +217,20 @@ impl crate::io::IOInterface for BufferIO { ) -> indexmap::IndexMap> { self.inner.get_authentication(repository_name) } + fn error(&self, message: &str, context: &[(&str, &str)]) { + self.inner.error(message, context) + } + + fn warning(&self, message: &str, context: &[(&str, &str)]) { + self.inner.warning(message, context) + } + + fn debug(&self, message: &str, context: &[(&str, &str)]) { + self.inner.debug(message, context) + } +} + +impl crate::io::IOInterfaceMutable for BufferIO { fn set_authentication( &mut self, repository_name: String, @@ -261,6 +245,8 @@ impl crate::io::IOInterface for BufferIO { } } +impl crate::io::IOInterface for BufferIO {} + impl crate::io::BaseIO for BufferIO { fn authentications( &self, -- cgit v1.3.1