1
0
mirror of https://github.com/jht5945/rust_util.git synced 2025-12-27 07:30:05 +08:00

add fn flush_stdout()

This commit is contained in:
2019-07-21 13:24:18 +08:00
parent 6d7c248805
commit 610871e5fc

View File

@@ -52,9 +52,16 @@ pub fn print_message(mt: MessageType, message: &str) {
}
}
pub fn flush_stdout() {
match io::stdout().flush() {
Err(err) => print_message(MessageType::ERROR, &format!("Flush stdout failed: {}", err)),
Ok(_) => (),
}
}
pub fn print_lastline(line: &str) {
print!("\x1b[100D{}\x1b[K", line);
io::stdout().flush().unwrap();
flush_stdout();
}
pub fn get_display_size(size: i64) -> String {