/// Draws a progress bar for a disk sync.
///
/// Uses the dirty value before our copy as our 'goal' by reading from
/// `/proc/meminfo`. This isn't an exact science and is just a rough estimate
/// of our completion.
///
/// Meant to be run on a thread parallel to the actual sync process and exits
/// after receiving a signal from main that the sync is complete.
Draws a progress bar for a disk sync.
Uses the dirty value before our copy as our 'goal' by reading from
`/proc/meminfo`. This isn't an exact science and is just a rough estimate
of our completion.

Meant to be run on a thread parallel to the actual sync process and exits
after receiving a signal from main that the sync is complete.
Draws a progress bar for a disk sync . Uses the dirty value before our copy as our ' goal ' by reading from ` / proc / meminfo ` . This isn ' t an exact science and is just a rough estimate of our completion . Meant to be run on a thread parallel to the actual sync process and exits after receiving a signal from main that the sync is complete .
fn sync_progress_bar(
    rx: &mpsc::Receiver<()>,
    mut progress_bar: progress::Bar,
    mut dirty: DirtyInfo,
) {
    progress_bar.set_job_title("syncing... (2/2)");
    loop {
        dirty.current = get_dirty_bytes();
        progress_bar.reach_percent(dirty.calc_sync_percent());
        thread::sleep(Duration::from_millis(500));
        if matches!(
            rx.try_recv(),
            Ok(_) | Err(mpsc::TryRecvError::Disconnected)
        ) {
            return;
        }
    }
}
fn sync_progress_bar ( rx : & mpsc :: Receiver < ( ) > , mut progress_bar : progress :: Bar , mut dirty : DirtyInfo , ) { progress_bar . set_job_title ( " " ) ; loop { dirty . current = get_dirty_bytes ( ) ; progress_bar . reach_percent ( dirty . calc_sync_percent ( ) ) ; thread :: sleep ( Duration :: from_millis ( 500 ) ) ; if matches ! ( rx try_recv ( ) Ok ( ) Err ( mpsc TryRecvError Disconnected ) ) { return ; } } }
Draws a progress bar for a disk sync.
Draws a progress bar for a disk sync .
rx
&mpsc::Receiver<()>
progress_bar
progress::Bar
dirty
DirtyInfo