📅  最后修改于: 2022-03-11 14:57:53.586000             🧑  作者: Mango
use std::{
io::{stdout, Write},
thread::sleep,
time::Duration,
};
fn main() {
let mut stdout = stdout();
for i in 0..=100 {
print!("\rProcessing {}%...", i);
// or
// stdout.write(format!("\rProcessing {}%...", i).as_bytes()).unwrap();
stdout.flush().unwrap();
sleep(Duration::from_millis(20));
}
println!();
}