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/installation_manager.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'crates/shirabe/src/installer/installation_manager.rs') diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs index 073625b..8275b41 100644 --- a/crates/shirabe/src/installer/installation_manager.rs +++ b/crates/shirabe/src/installer/installation_manager.rs @@ -96,10 +96,9 @@ impl InstallationManager { /// code is ever executed. pub fn disable_plugins(&mut self) { for installer in self.installers.iter_mut() { - // TODO(phase-b): $installer instanceof PluginInstaller downcast - let plugin_installer: Option<&mut PluginInstaller> = None; - let _ = plugin_installer; - // if let Some(pi) = plugin_installer { pi.disable_plugins(); } + if let Some(plugin_installer) = installer.as_plugin_installer_mut() { + plugin_installer.disable_plugins(); + } } } @@ -161,12 +160,9 @@ impl InstallationManager { }; // if the given installer support installing binaries - // TODO(phase-b): $installer instanceof BinaryPresenceInterface downcast - let bp: Option<&dyn BinaryPresenceInterface> = None; - if let Some(bp) = bp { + if let Some(bp) = installer.as_binary_presence_interface() { bp.ensure_binaries_presence(package); } - let _ = installer; } /// Executes solver operation. -- cgit v1.3.1