refactor(console): 📦 Improve console code

This commit is contained in:
Berkus Decker 2022-10-07 16:43:56 +03:00 committed by Berkus Decker
parent e228a1cff4
commit e95b01104a
1 changed files with 4 additions and 6 deletions

View File

@ -76,14 +76,12 @@ pub struct Console {
impl Default for Console {
fn default() -> Self {
Console {
output: (NullConsole {}).into(),
}
Self::new()
}
}
impl Console {
pub const fn new() -> Console {
pub const fn new() -> Self {
Console {
output: Output::None(NullConsole {}),
}
@ -99,10 +97,10 @@ impl Console {
/// Overwrite the current output. The old output will go out of scope and
/// its Drop function will be called.
pub fn replace_with(&mut self, x: Output) {
pub fn replace_with(&mut self, new_output: Output) {
self.current_ptr().flush();
self.output = x;
self.output = new_output;
}
/// A command prompt.