mirror of
https://github.com/alacritty/alacritty.git
synced 2025-07-31 22:03:40 -04:00
Change green implementation to use the macro
This commit is contained in:
parent
f55252ec85
commit
128c25ee8b
1 changed files with 3 additions and 15 deletions
18
src/util.rs
18
src/util.rs
|
@ -74,24 +74,12 @@ pub mod fmt {
|
||||||
/// Write a `Display` or `Debug` escaped with Red
|
/// Write a `Display` or `Debug` escaped with Red
|
||||||
pub struct Red => "31";
|
pub struct Red => "31";
|
||||||
|
|
||||||
|
/// Write a `Display` or `Debug` escaped with Green
|
||||||
|
pub struct Green => "32";
|
||||||
|
|
||||||
/// Write a `Display` or `Debug` escaped with Yellow
|
/// Write a `Display` or `Debug` escaped with Yellow
|
||||||
pub struct Yellow => "33";
|
pub struct Yellow => "33";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write a `Display` or `Debug` escaped with Red
|
|
||||||
pub struct Green<T>(pub T);
|
|
||||||
|
|
||||||
impl<T: fmt::Display> fmt::Display for Green<T> {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "\x1b[32m{}\x1b[0m", self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: fmt::Debug> fmt::Debug for Green<T> {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
||||||
write!(f, "\x1b[32m{:?}\x1b[0m", self.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue