1#[allow(clippy::exhaustive_structs)]
3#[derive(#[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::marker::Copy for Reset { }Copy, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::clone::Clone for Reset {
#[inline]
fn clone(&self) -> Reset { *self }
}Clone, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::default::Default for Reset {
#[inline]
fn default() -> Reset { Reset {} }
}Default, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::fmt::Debug for Reset {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f, "Reset")
}
}Debug, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::cmp::PartialEq for Reset {
#[inline]
fn eq(&self, other: &Reset) -> bool { true }
}PartialEq, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::cmp::Eq for Reset {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::cmp::PartialOrd for Reset {
#[inline]
fn partial_cmp(&self, other: &Reset)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ordering::Equal)
}
}PartialOrd, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::cmp::Ord for Reset {
#[inline]
fn cmp(&self, other: &Reset) -> ::core::cmp::Ordering {
::core::cmp::Ordering::Equal
}
}Ord, #[automatically_derived]
#[allow(clippy::exhaustive_structs)]
impl ::core::hash::Hash for Reset {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {}
}Hash)]
4pub struct Reset;
5
6impl Reset {
7 #[inline]
11 pub fn render(self) -> impl core::fmt::Display + Copy {
12 self
13 }
14}
15
16impl core::fmt::Display for Reset {
17 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
18 f.write_str(RESET)
19 }
20}
21
22pub(crate) const RESET: &str = "\x1B[0m";
23
24#[cfg(test)]
25#[cfg(feature = "std")]
26mod test {
27 use super::*;
28
29 #[test]
30 fn print_size_of() {
31 use core::mem::size_of;
32 dbg!(size_of::<Reset>());
33 }
34
35 #[test]
36 fn no_align() {
37 #[track_caller]
38 fn assert_no_align(d: impl core::fmt::Display) {
39 let expected = format!("{d}");
40 let actual = format!("{d:<10}");
41 assert_eq!(expected, actual);
42 }
43
44 assert_no_align(Reset);
45 assert_no_align(Reset.render());
46 }
47}