diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-28 03:31:41 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-28 03:32:04 +0900 |
| commit | c7f53c5d7d581ebf76803650c63ec615b1558dc8 (patch) | |
| tree | c6d83819e82a83cf93ca737b661094a8ea800cec /crates/shirabe/src/console/application.rs | |
| parent | cc5d73c05a0abca2eebcc8a6afa0b1543ee49850 (diff) | |
| download | php-shirabe-refactor/composer-handles.tar.gz php-shirabe-refactor/composer-handles.tar.zst php-shirabe-refactor/composer-handles.zip | |
refactor(composer): represent composer via trait-based handlesrefactor/composer-handles
Replace the PartialComposer/Composer structs and the single
Rc<RefCell<PartialOrFullComposer>> enum with PartialComposer and
Composer traits (Composer: PartialComposer), InnerPartialComposer /
InnerFullComposer data structs, and the handle types FullComposerHandle
(impl Composer) and AnyComposerHandle (polymorphic enum, impl
PartialComposer), plus their weak variants.
Factory builds the full and partial graphs via separate Rc::new_cyclic
branches that share a build_composer_base helper. Call sites now use
trait methods that encapsulate borrowing instead of borrow_partial() /
composer_full*().
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/console/application.rs')
| -rw-r--r-- | crates/shirabe/src/console/application.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index f27ed79..c8f8e43 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -67,8 +67,7 @@ use crate::command::SuggestsCommand; use crate::command::UpdateCommand; use crate::command::ValidateCommand; use crate::composer; -use crate::composer::ComposerHandle; -use crate::composer::PartialComposerHandle; +use crate::composer::{AnyComposerHandle, Composer, PartialComposer}; use crate::console::GithubActionError; use crate::downloader::TransportException; use crate::event_dispatcher::ScriptExecutionException; @@ -89,7 +88,7 @@ use crate::util::Silencer; #[derive(Debug)] pub struct Application { inner: BaseApplication, - pub(crate) composer: Option<PartialComposerHandle>, + pub(crate) composer: Option<AnyComposerHandle>, pub(crate) io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>, has_plugin_commands: bool, disable_plugins_by_default: bool, @@ -854,7 +853,6 @@ impl Application { let composer = self.get_composer(false, Some(true), None)?; if composer.is_some() && function_exists("disk_free_space") { let composer = composer.unwrap(); - let composer = composer.borrow_partial(); let config = composer.get_config(); let min_space_free: f64 = 100.0 * 1024.0 * 1024.0; @@ -986,7 +984,7 @@ impl Application { required: bool, disable_plugins: Option<bool>, disable_scripts: Option<bool>, - ) -> anyhow::Result<Option<PartialComposerHandle>> { + ) -> anyhow::Result<Option<AnyComposerHandle>> { let disable_plugins = disable_plugins.unwrap_or(self.disable_plugins_by_default); let disable_scripts = disable_scripts.unwrap_or(self.disable_scripts_by_default); |
