Onwribing cetakan pada karat baris yang sama
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!();
}
Nervous Narwhal