From 1921f173ea219cb4b25847294d2d3fa465550fbb Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 25 May 2026 00:58:20 +0900 Subject: refactor(package): introduce Rc> handles for packages PHP packages have reference semantics, so introduce shared-ownership handles over an AnyPackage enum (PackageInterfaceHandle and friends) and replace Box throughout. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/repository/installed_filesystem_repository.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/repository/installed_filesystem_repository.rs') diff --git a/crates/shirabe/src/repository/installed_filesystem_repository.rs b/crates/shirabe/src/repository/installed_filesystem_repository.rs index 5c6fecf..8a6359a 100644 --- a/crates/shirabe/src/repository/installed_filesystem_repository.rs +++ b/crates/shirabe/src/repository/installed_filesystem_repository.rs @@ -6,9 +6,10 @@ use shirabe_php_shim::Countable; use shirabe_semver::constraint::AnyConstraint; use crate::json::JsonFile; -use crate::package::BasePackage; +use crate::package::BasePackageHandle; use crate::package::PackageInterface; -use crate::package::RootPackageInterface; +use crate::package::PackageInterfaceHandle; +use crate::package::RootPackageInterfaceHandle; use crate::repository::AdvisoryProviderInterface; use crate::repository::FilesystemRepository; use crate::repository::InstalledRepositoryInterface; @@ -27,7 +28,7 @@ impl InstalledFilesystemRepository { pub fn new( repository_file: JsonFile, dump_versions: bool, - root_package: Option>, + root_package: Option, filesystem: Option>>, ) -> Result { Ok(Self { @@ -66,7 +67,7 @@ impl WritableRepositoryInterface for InstalledFilesystemRepository { fn add_package( &mut self, - package: Box, + package: crate::package::PackageInterfaceHandle, ) -> anyhow::Result<()> { todo!() } @@ -78,7 +79,7 @@ impl WritableRepositoryInterface for InstalledFilesystemRepository { todo!() } - fn get_canonical_packages(&self) -> Vec> { + fn get_canonical_packages(&self) -> Vec { todo!() } @@ -109,17 +110,17 @@ impl RepositoryInterface for InstalledFilesystemRepository { &self, _name: &str, _constraint: FindPackageConstraint, - ) -> Option> { + ) -> Option { todo!() } fn find_packages( &self, _name: &str, _constraint: Option, - ) -> Vec> { + ) -> Vec { todo!() } - fn get_packages(&self) -> Vec> { + fn get_packages(&self) -> Vec { todo!() } fn load_packages( @@ -127,7 +128,7 @@ impl RepositoryInterface for InstalledFilesystemRepository { _package_name_map: IndexMap>, _acceptable_stabilities: IndexMap, _stability_flags: IndexMap, - _already_loaded: IndexMap>>, + _already_loaded: IndexMap>, ) -> LoadPackagesResult { todo!() } -- cgit v1.3.1