Macro progress_observer::reprint
source · macro_rules! reprint { ($($tk:tt)*) => { ... }; }
Expand description
Utility macro for re-printing over the same terminal line. Useful when used in tandem with a progress observer.
use progress_observer::prelude::*;
use std::time::Duration;
// benchmark how many integers you can add per second
let mut count: u128 = 0;
for should_print in Observer::new(Duration::from_secs(1)).take(100_000_000) {
count += 1;
if should_print {
reprint!("{count}");
count = 0;
}
}