pub struct ConsoleProgressPrinter { /* private fields */ }Implementations§
Source§impl ConsoleProgressPrinter
impl ConsoleProgressPrinter
Sourcepub fn new_update_rate(update_rate: Duration) -> ConsoleProgressPrinter
pub fn new_update_rate(update_rate: Duration) -> ConsoleProgressPrinter
Examples found in repository?
examples/progress.rs (line 11)
8pub fn main() -> Result<(), std::io::Error> {
9 let elements = 1000;
10
11 let prog = ConsoleProgressPrinter::new_update_rate(Duration::from_millis(100));
12 let task = Task::new(0, "Test Task".to_string(), u64::MAX);
13 prog.track_task_progress(&task);
14 task.mark_started();
15 for i in 0..elements {
16 task.mark_one_completed();
17
18 let status = format!("Phase {}", i / 100);
19 task.set_current_status(Some(status));
20
21 std::thread::sleep(std::time::Duration::from_millis(5));
22 }
23
24 Ok(())
25}More examples
examples/progress_random_write.rs (line 18)
15pub fn main() -> Result<(), Error> {
16 let mut rand = Random::default();
17
18 let cons = ConsoleProgressPrinter::new_update_rate(Duration::from_millis(100));
19 let task = Task::new_infinite_named("Writer".to_string());
20 cons.track_task_progress(&task);
21 task.mark_started();
22
23 let out = OpenOptions::new()
24 .write(true)
25 .truncate(true)
26 .create(true)
27 .open("test")?;
28 let out = BufWriter::new(out);
29 let mut out = WriterTask::new(out, task);
30
31 let gb = 1_000_000_000 / 8;
32 for _i in 0..gb {
33 out.write_be_u64(rand.next_u64())?;
34 }
35
36 Ok(())
37}Trait Implementations§
Source§impl Drop for ConsoleProgressPrinter
impl Drop for ConsoleProgressPrinter
Source§impl ProgressPrinter for ConsoleProgressPrinter
impl ProgressPrinter for ConsoleProgressPrinter
Source§fn track_task_progress(&self, task: &Task)
fn track_task_progress(&self, task: &Task)
Track and display the progress for this specific task.
Auto Trait Implementations§
impl Freeze for ConsoleProgressPrinter
impl !RefUnwindSafe for ConsoleProgressPrinter
impl Send for ConsoleProgressPrinter
impl Sync for ConsoleProgressPrinter
impl Unpin for ConsoleProgressPrinter
impl !UnwindSafe for ConsoleProgressPrinter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more