1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#[macro_export]
macro_rules! csi {
($( $l:expr ),*) => { concat!("\x1B[", $( $l ),*) };
}
#[macro_export]
macro_rules! write_cout {
($string:expr) => {{
let stdout = ::std::io::stdout();
let mut stdout = stdout.lock();
let mut size = 0;
let result = stdout.write($string.as_bytes());
size += match result {
Ok(size) => size,
Err(e) => return Err(crossterm_utils::ErrorKind::IoError(e)),
};
match stdout.flush() {
Ok(_) => Ok(size),
Err(e) => Err(crossterm_utils::ErrorKind::IoError(e)),
}
}};
}