aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/installer/project_installer.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-25 00:58:20 +0900
committernsfisis <nsfisis@gmail.com>2026-05-25 00:58:36 +0900
commit1921f173ea219cb4b25847294d2d3fa465550fbb (patch)
tree0d30486a2cb9a0c106e5d5827be3f655c60cd871 /crates/shirabe/src/installer/project_installer.rs
parentdbdecaf5a1c54a876b7ee0153d58dd39b1080f97 (diff)
downloadphp-shirabe-1921f173ea219cb4b25847294d2d3fa465550fbb.tar.gz
php-shirabe-1921f173ea219cb4b25847294d2d3fa465550fbb.tar.zst
php-shirabe-1921f173ea219cb4b25847294d2d3fa465550fbb.zip
refactor(package): introduce Rc<RefCell<_>> handles for packages
PHP packages have reference semantics, so introduce shared-ownership handles over an AnyPackage enum (PackageInterfaceHandle and friends) and replace Box<dyn PackageInterface> 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.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crates/shirabe/src/installer/project_installer.rs b/crates/shirabe/src/installer/project_installer.rs
index 8960854..129810b 100644
--- a/crates/shirabe/src/installer/project_installer.rs
+++ b/crates/shirabe/src/installer/project_installer.rs
@@ -3,6 +3,7 @@
use crate::downloader::DownloadManager;
use crate::installer::InstallerInterface;
use crate::package::PackageInterface;
+use crate::package::PackageInterfaceHandle;
use crate::repository::InstalledRepositoryInterface;
use crate::util::Filesystem;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
@@ -95,19 +96,22 @@ impl InstallerInterface for ProjectInstaller {
async fn install(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- package: &dyn PackageInterface,
+ package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
self.download_manager
.borrow()
- .install(package, &self.install_path)
+ .install(
+ package.as_rc().borrow().as_package_interface(),
+ &self.install_path,
+ )
.await
}
async fn update(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- _initial: &dyn PackageInterface,
- _target: &dyn PackageInterface,
+ _initial: &PackageInterfaceHandle,
+ _target: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
Err(InvalidArgumentException {
message: "not supported".to_string(),
@@ -119,7 +123,7 @@ impl InstallerInterface for ProjectInstaller {
async fn uninstall(
&mut self,
_repo: &mut dyn InstalledRepositoryInterface,
- _package: &dyn PackageInterface,
+ _package: &PackageInterfaceHandle,
) -> anyhow::Result<Option<PhpMixed>> {
Err(InvalidArgumentException {
message: "not supported".to_string(),