diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-27 00:49:33 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-27 00:54:09 +0900 |
| commit | cc5d73c05a0abca2eebcc8a6afa0b1543ee49850 (patch) | |
| tree | 091a0d01232d927f13f3ab22700701804980f231 /crates/shirabe/src/installer/project_installer.rs | |
| parent | c5850d62beabef0a6bcc4cf6a179589c0ba8f405 (diff) | |
| download | php-shirabe-cc5d73c05a0abca2eebcc8a6afa0b1543ee49850.tar.gz php-shirabe-cc5d73c05a0abca2eebcc8a6afa0b1543ee49850.tar.zst php-shirabe-cc5d73c05a0abca2eebcc8a6afa0b1543ee49850.zip | |
refactor(package): pass package handles by value throughout
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/installer/project_installer.rs')
| -rw-r--r-- | crates/shirabe/src/installer/project_installer.rs | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/crates/shirabe/src/installer/project_installer.rs b/crates/shirabe/src/installer/project_installer.rs index 129810b..6c8a279 100644 --- a/crates/shirabe/src/installer/project_installer.rs +++ b/crates/shirabe/src/installer/project_installer.rs @@ -2,7 +2,6 @@ use crate::downloader::DownloadManager; use crate::installer::InstallerInterface; -use crate::package::PackageInterface; use crate::package::PackageInterfaceHandle; use crate::repository::InstalledRepositoryInterface; use crate::util::Filesystem; @@ -39,15 +38,15 @@ impl InstallerInterface for ProjectInstaller { fn is_installed( &self, _repo: &dyn InstalledRepositoryInterface, - _package: &dyn PackageInterface, + _package: PackageInterfaceHandle, ) -> bool { false } async fn download( &self, - package: &dyn PackageInterface, - prev_package: Option<&dyn PackageInterface>, + package: PackageInterfaceHandle, + prev_package: Option<PackageInterfaceHandle>, ) -> anyhow::Result<Option<PhpMixed>> { let install_path = &self.install_path; if std::path::Path::new(install_path).exists() @@ -72,8 +71,8 @@ impl InstallerInterface for ProjectInstaller { async fn prepare( &self, r#type: &str, - package: &dyn PackageInterface, - prev_package: Option<&dyn PackageInterface>, + package: PackageInterfaceHandle, + prev_package: Option<PackageInterfaceHandle>, ) -> anyhow::Result<Option<PhpMixed>> { self.download_manager .borrow() @@ -84,8 +83,8 @@ impl InstallerInterface for ProjectInstaller { async fn cleanup( &self, r#type: &str, - package: &dyn PackageInterface, - prev_package: Option<&dyn PackageInterface>, + package: PackageInterfaceHandle, + prev_package: Option<PackageInterfaceHandle>, ) -> anyhow::Result<Option<PhpMixed>> { self.download_manager .borrow() @@ -96,22 +95,19 @@ impl InstallerInterface for ProjectInstaller { async fn install( &mut self, _repo: &mut dyn InstalledRepositoryInterface, - package: &PackageInterfaceHandle, + package: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { self.download_manager .borrow() - .install( - package.as_rc().borrow().as_package_interface(), - &self.install_path, - ) + .install(package, &self.install_path) .await } async fn update( &mut self, _repo: &mut dyn InstalledRepositoryInterface, - _initial: &PackageInterfaceHandle, - _target: &PackageInterfaceHandle, + _initial: PackageInterfaceHandle, + _target: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { Err(InvalidArgumentException { message: "not supported".to_string(), @@ -123,7 +119,7 @@ impl InstallerInterface for ProjectInstaller { async fn uninstall( &mut self, _repo: &mut dyn InstalledRepositoryInterface, - _package: &PackageInterfaceHandle, + _package: PackageInterfaceHandle, ) -> anyhow::Result<Option<PhpMixed>> { Err(InvalidArgumentException { message: "not supported".to_string(), @@ -132,7 +128,7 @@ impl InstallerInterface for ProjectInstaller { .into()) } - fn get_install_path(&self, _package: &dyn PackageInterface) -> Option<String> { + fn get_install_path(&self, _package: PackageInterfaceHandle) -> Option<String> { Some(self.install_path.clone()) } } |
