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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user