diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-22 04:38:26 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-22 04:55:34 +0900 |
| commit | ffd3e239a56172d2a336fb4d6253c01f6b1a0100 (patch) | |
| tree | 344b02702bafcb503806cec94d6433807e0ce5b0 /crates/shirabe/src/lib.rs | |
| parent | c3bf6c567ba2eac2830fa6eddcf4fadf619eb17b (diff) | |
| download | php-shirabe-ffd3e239a56172d2a336fb4d6253c01f6b1a0100.tar.gz php-shirabe-ffd3e239a56172d2a336fb4d6253c01f6b1a0100.tar.zst php-shirabe-ffd3e239a56172d2a336fb4d6253c01f6b1a0100.zip | |
refactor(console): introduce ApplicationHandle shared-ownership newtype
Collapse the dual Application API (static methods taking
`&Rc<RefCell<Application>>` plus `&mut self` bridges via `shared()`) into a
single handle type `ApplicationHandle(Rc<RefCell<Application>>)`, mirroring the
Composer handle pattern.
Methods that invoke command callbacks (add, run, do_run, base_run, base_do_run,
do_run_command, add_commands, init) move to `impl ApplicationHandle` with
short-scoped borrows; data-only methods and `impl BaseApplication` stay on
`Application`. `shared()` now returns the handle, and `new_shared`/`init_shared`
fold into `ApplicationHandle::new`/`init`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/lib.rs')
| -rw-r--r-- | crates/shirabe/src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/shirabe/src/lib.rs b/crates/shirabe/src/lib.rs index 8d8cc96..ec63ee1 100644 --- a/crates/shirabe/src/lib.rs +++ b/crates/shirabe/src/lib.rs @@ -26,7 +26,7 @@ pub mod self_update; pub mod util; pub fn run(argv: Vec<String>) -> anyhow::Result<i32> { - use crate::console::Application; + use crate::console::ApplicationHandle; use crate::util::Platform; use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput; use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; @@ -39,10 +39,10 @@ pub fn run(argv: Vec<String>) -> anyhow::Result<i32> { .unwrap_or_default(), ); - let application = Application::new_shared("Composer".to_string(), String::new())?; + let application = ApplicationHandle::new("Composer".to_string(), String::new())?; let input = std::rc::Rc::new(std::cell::RefCell::new(ArgvInput::new(Some(argv), None)?)) as std::rc::Rc<std::cell::RefCell<dyn InputInterface>>; - Application::run(&application, Some(input), None) + application.run(Some(input), None) } #[cfg(test)] |
