diff options
Diffstat (limited to 'crates/shirabe-external-packages/src/symfony/console/style')
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/style/output_style.rs | 23 | ||||
| -rw-r--r-- | crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs | 22 |
2 files changed, 24 insertions, 21 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs index 9a162746..12fd3dcb 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs @@ -7,17 +7,15 @@ use crate::symfony::console::output::OutputInterface; use crate::symfony::console::output::output_interface::OUTPUT_NORMAL; use crate::symfony::console::style::style_interface::StyleInterface; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; -use std::rc::Rc; /// Decorates output to add console style guide helpers. #[derive(Debug)] pub struct OutputStyle { - output: Rc<RefCell<dyn OutputInterface>>, + output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, } impl OutputStyle { - pub fn new(output: Rc<RefCell<dyn OutputInterface>>) -> Self { + pub fn new(output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self { Self { output } } @@ -25,7 +23,7 @@ impl OutputStyle { ProgressBar::new(self.output.clone(), max, 1.0 / 25.0) } - pub(crate) fn get_error_output(&self) -> Rc<RefCell<dyn OutputInterface>> { + pub(crate) fn get_error_output(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> { // PHP checks `$this->output instanceof ConsoleOutputInterface`; this requires // runtime type information that the OutputInterface trait object lacks. if !Self::is_console_output_interface(&self.output) { @@ -38,7 +36,9 @@ impl OutputStyle { .get_error_output() } - fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool { + fn is_console_output_interface( + output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) -> bool { // ConsoleOutput is the only OutputInterface implementor that also implements // ConsoleOutputInterface, so `instanceof ConsoleOutputInterface` reduces to this downcast. shirabe_php_shim::AsAny::as_any(&*output.borrow()) @@ -47,8 +47,8 @@ impl OutputStyle { } fn as_console_output_interface( - _output: &Rc<RefCell<dyn OutputInterface>>, - ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> { + _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> { todo!() } } @@ -94,11 +94,14 @@ impl OutputInterface for OutputStyle { self.output.borrow().is_decorated() } - fn set_formatter(&self, formatter: Rc<RefCell<dyn OutputFormatterInterface>>) { + fn set_formatter( + &self, + formatter: std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>>, + ) { self.output.borrow().set_formatter(formatter); } - fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> { + fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> { self.output.borrow().get_formatter() } } diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs index 425c815b..69cd4191 100644 --- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs +++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs @@ -24,15 +24,13 @@ use crate::symfony::console::style::output_style::OutputStyle; use crate::symfony::console::style::style_interface::StyleInterface; use crate::symfony::console::terminal::Terminal; use shirabe_php_shim::PhpMixed; -use std::cell::RefCell; -use std::rc::Rc; /// Output decorator helpers for the Symfony Style Guide. #[derive(Debug)] pub struct SymfonyStyle { inner: OutputStyle, - input: Rc<RefCell<dyn InputInterface>>, - output: Rc<RefCell<dyn OutputInterface>>, + input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, + output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, question_helper: Option<SymfonyQuestionHelper>, progress_bar: Option<ProgressBar>, line_length: i64, @@ -43,8 +41,8 @@ pub const MAX_LINE_LENGTH: i64 = 120; impl SymfonyStyle { pub fn new( - input: Rc<RefCell<dyn InputInterface>>, - output: Rc<RefCell<dyn OutputInterface>>, + input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>, + output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, ) -> Self { let buffered_output = TrimmedBufferOutput::new( if std::path::MAIN_SEPARATOR == '\\' { @@ -260,7 +258,7 @@ impl SymfonyStyle { Self::as_console_output_interface(&self.output) .unwrap() .borrow() - .section() as Rc<RefCell<dyn OutputInterface>> + .section() as std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> } else { self.output.clone() }; @@ -435,11 +433,13 @@ impl SymfonyStyle { lines } - fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> { + fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> { self.output.borrow().get_formatter() } - fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool { + fn is_console_output_interface( + output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) -> bool { // ConsoleOutput is the only OutputInterface implementor that also implements // ConsoleOutputInterface, so `instanceof ConsoleOutputInterface` reduces to this downcast. shirabe_php_shim::AsAny::as_any(&*output.borrow()) @@ -448,8 +448,8 @@ impl SymfonyStyle { } fn as_console_output_interface( - _output: &Rc<RefCell<dyn OutputInterface>>, - ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> { + _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>, + ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> { todo!() } |
