refactor(console): 📦 Improve console code
This commit is contained in:
parent
e228a1cff4
commit
e95b01104a
|
@ -76,14 +76,12 @@ pub struct Console {
|
||||||
|
|
||||||
impl Default for Console {
|
impl Default for Console {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Console {
|
Self::new()
|
||||||
output: (NullConsole {}).into(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Console {
|
impl Console {
|
||||||
pub const fn new() -> Console {
|
pub const fn new() -> Self {
|
||||||
Console {
|
Console {
|
||||||
output: Output::None(NullConsole {}),
|
output: Output::None(NullConsole {}),
|
||||||
}
|
}
|
||||||
|
@ -99,10 +97,10 @@ impl Console {
|
||||||
|
|
||||||
/// Overwrite the current output. The old output will go out of scope and
|
/// Overwrite the current output. The old output will go out of scope and
|
||||||
/// its Drop function will be called.
|
/// 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.current_ptr().flush();
|
||||||
|
|
||||||
self.output = x;
|
self.output = new_output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A command prompt.
|
/// A command prompt.
|
||||||
|
|
Loading…
Reference in New Issue