aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/io/io_interface.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-03 00:34:01 +0900
committernsfisis <nsfisis@gmail.com>2026-06-03 00:34:01 +0900
commite93ea9ae1058334fc72b7795021bb42c1bd64401 (patch)
treedd0972233aa13308975f7a3c1e0380ebbd7672ec /crates/shirabe/src/io/io_interface.rs
parent51843230859ef39344c0b67daa9049ead87ec49c (diff)
downloadphp-shirabe-e93ea9ae1058334fc72b7795021bb42c1bd64401.tar.gz
php-shirabe-e93ea9ae1058334fc72b7795021bb42c1bd64401.tar.zst
php-shirabe-e93ea9ae1058334fc72b7795021bb42c1bd64401.zip
feat(io): add as_any downcast shims for IOInterface and OutputInterface
Introduce the cross-cutting downcast base for PHP `instanceof` checks on io/output trait objects: `IOInterface::as_any` (ConsoleIO/NullIO/BufferIO) and `OutputInterface::as_console_output_interface` (promoting ConsoleOutput to a proper ConsoleOutputInterface). Wire the resolved downcasts in ConsoleIO error output, Auditor table format, and the event dispatcher. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/io/io_interface.rs')
-rw-r--r--crates/shirabe/src/io/io_interface.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/shirabe/src/io/io_interface.rs b/crates/shirabe/src/io/io_interface.rs
index aac1488..e48f9ce 100644
--- a/crates/shirabe/src/io/io_interface.rs
+++ b/crates/shirabe/src/io/io_interface.rs
@@ -149,7 +149,9 @@ pub trait IOInterfaceMutable {
// PHP `IOInterface`. This is the type used for the shared trait object
// `dyn IOInterface`; its vtable carries both the immutable and mutable methods.
-pub trait IOInterface: IOInterfaceImmutable + IOInterfaceMutable {}
+pub trait IOInterface: IOInterfaceImmutable + IOInterfaceMutable {
+ fn as_any(&self) -> &dyn std::any::Any;
+}
// Shared-ownership handle for a PHP IO instance (reference semantics). It
// exposes only the immutable surface; mutating methods (`set_authentication`,