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