1 | /// Reset terminal formatting |
2 | #[derive (Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] |
3 | pub struct Reset; |
4 | |
5 | impl Reset { |
6 | /// Render the ANSI code |
7 | #[inline ] |
8 | pub fn render(self) -> impl core::fmt::Display + Copy + Clone { |
9 | ResetDisplay |
10 | } |
11 | } |
12 | |
13 | #[derive (Copy, Clone, Default, Debug)] |
14 | struct ResetDisplay; |
15 | |
16 | impl core::fmt::Display for ResetDisplay { |
17 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
18 | RESET.fmt(f) |
19 | } |
20 | } |
21 | |
22 | pub(crate) const RESET: &str = " \x1B[0m" ; |
23 | |