From d59da23db4aeabd1c6807bcddce562e19b645796 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 5 Jun 2026 02:08:55 +0900 Subject: feat(installer): wire InstallerInterface marker-trait downcasts Add as_binary_presence_interface and as_plugin_installer_mut to InstallerInterface following the downloader marker-trait downcast pattern, so InstallationManager can model the PHP instanceof checks in ensureBinariesPresence and disablePlugins. Make BinaryPresenceInterface take &mut self, resolving LibraryInstaller's stubbed trait impl. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/installer/library_installer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'crates/shirabe/src/installer/library_installer.rs') diff --git a/crates/shirabe/src/installer/library_installer.rs b/crates/shirabe/src/installer/library_installer.rs index b4b2d20..58706d6 100644 --- a/crates/shirabe/src/installer/library_installer.rs +++ b/crates/shirabe/src/installer/library_installer.rs @@ -418,13 +418,14 @@ impl InstallerInterface for LibraryInstaller { base_path }) } + + fn as_binary_presence_interface(&mut self) -> Option<&mut dyn BinaryPresenceInterface> { + Some(self) + } } impl BinaryPresenceInterface for LibraryInstaller { - fn ensure_binaries_presence(&self, _package: PackageInterfaceHandle) { - // TODO(phase-b): trait takes &self but LibraryInstaller::ensure_binaries_presence - // requires &mut self due to BinaryInstaller::install_binaries(&mut self, ...). - // Revisit the trait or use interior mutability. - todo!() + fn ensure_binaries_presence(&mut self, package: PackageInterfaceHandle) { + LibraryInstaller::ensure_binaries_presence(self, package); } } -- cgit v1.3.1