workflow_terminal/
clear.rs1use std::fmt;
6
7pub struct ClearLine;
10
11impl fmt::Display for ClearLine {
12 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
13 write!(f, "\x1B[2K\r")
14 }
15}
16
17impl AsRef<[u8]> for ClearLine {
18 fn as_ref(&self) -> &'static [u8] {
19 "\x1B[2K\r".as_bytes()
20 }
21}
22
23impl AsRef<str> for ClearLine {
24 fn as_ref(&self) -> &'static str {
25 "\x1B[2K\r"
26 }
27}
28
29pub struct ClearScreen;
31
32impl fmt::Display for ClearScreen {
33 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
34 write!(f, "\x1B[2J")
35 }
36}
37
38impl AsRef<[u8]> for ClearScreen {
39 fn as_ref(&self) -> &'static [u8] {
40 "\x1B[2J".as_bytes()
41 }
42}
43
44impl AsRef<str> for ClearScreen {
45 fn as_ref(&self) -> &'static str {
46 "\x1B[2J"
47 }
48}