diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-05 02:42:02 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-05 02:42:02 +0900 |
| commit | 9a25fcfc82b72f60facd381786ca5490acca032c (patch) | |
| tree | b34b36c19f14d57d160b8e4235a8040011bdec60 /crates/shirabe/src/installer/package_event.rs | |
| parent | 886ee829cb191745167dca369045acd3125e5714 (diff) | |
| download | php-shirabe-9a25fcfc82b72f60facd381786ca5490acca032c.tar.gz php-shirabe-9a25fcfc82b72f60facd381786ca5490acca032c.tar.zst php-shirabe-9a25fcfc82b72f60facd381786ca5490acca032c.zip | |
feat(dependency-resolver): share operations via Rc, drop clone_box
OperationInterface::clone_box (a todo!() trait-object clone stub) is
removed in favor of Rc<dyn OperationInterface> shared ownership. All its
methods are &self, so operations are immutable value objects that Rc can
share; pushing the same operation into multiple lists (installer's
install/uninstall splits) becomes a cheap Rc clone instead of clone_box.
Box<dyn OperationInterface> is replaced with Rc<dyn ...> across
Transaction (and its Lock/LocalRepo wrappers), Installer, PackageEvent,
InstallationManager and EventDispatcher; Box::new operation constructions
become Rc::new.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/installer/package_event.rs')
| -rw-r--r-- | crates/shirabe/src/installer/package_event.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/src/installer/package_event.rs b/crates/shirabe/src/installer/package_event.rs index 342732d..17f9113 100644 --- a/crates/shirabe/src/installer/package_event.rs +++ b/crates/shirabe/src/installer/package_event.rs @@ -14,8 +14,8 @@ pub struct PackageEvent { io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, dev_mode: bool, local_repo: Box<dyn RepositoryInterface>, - operations: Vec<Box<dyn OperationInterface>>, - operation: Box<dyn OperationInterface>, + operations: Vec<std::rc::Rc<dyn OperationInterface>>, + operation: std::rc::Rc<dyn OperationInterface>, } impl PackageEvent { @@ -25,8 +25,8 @@ impl PackageEvent { io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, dev_mode: bool, local_repo: Box<dyn RepositoryInterface>, - operations: Vec<Box<dyn OperationInterface>>, - operation: Box<dyn OperationInterface>, + operations: Vec<std::rc::Rc<dyn OperationInterface>>, + operation: std::rc::Rc<dyn OperationInterface>, ) -> Self { Self { inner: Event::new(event_name, vec![], IndexMap::new()), @@ -59,7 +59,7 @@ impl PackageEvent { self.local_repo.as_ref() } - pub fn get_operations(&self) -> &Vec<Box<dyn OperationInterface>> { + pub fn get_operations(&self) -> &Vec<std::rc::Rc<dyn OperationInterface>> { &self.operations } |
