fn progress_bar(&self, total_size: Option<u64>) -> ProgressBar {
        // No progress bar for quiet mode.
        if self.quiet {
            return ProgressBar::hidden();
        }

        // We want to limit refreshes to once per second, so we have to make a
        // new draw target.
        let target = ProgressDrawTarget::stderr_with_hz(PROGRESS_UPDATE_HZ);

        if let Some(size) = total_size {
            // If we know the total size, setup a nice bar
            let template = if self.no_color {
                PROGRESS_TEMPLATE_NO_COLOR
            }
            else {
                PROGRESS_TEMPLATE
            };

            let style = ProgressStyle::default_bar()
                .template(template)
                .progress_chars(PROGRESS_CHARS);

            let pb = ProgressBar::with_draw_target(size, target);
            pb.set_style(style);

            pb
        }
        else {
            // Otherwise, just a simple spinner
            let pb = ProgressBar::new_spinner();
            pb.set_draw_target(target);

            pb
        }
    }
// Handle creation of an appropriate progress bar
Handle creation of an appropriate progress bar
Handle creation of an appropriate progress bar
fn progress_bar(&self, total_size: Option<u64>) -> ProgressBar {
        // No progress bar for quiet mode.
        if self.quiet {
            return ProgressBar::hidden();
        }
        // We want to limit refreshes to once per second, so we have to make a
        // new draw target.
        let target = ProgressDrawTarget::stderr_with_hz(PROGRESS_UPDATE_HZ);
        if let Some(size) = total_size {
            // If we know the total size, setup a nice bar
            let template = if self.no_color {
                PROGRESS_TEMPLATE_NO_COLOR
            }
            else {
                PROGRESS_TEMPLATE
            };
            let style = ProgressStyle::default_bar()
                .template(template)
                .progress_chars(PROGRESS_CHARS);
            let pb = ProgressBar::with_draw_target(size, target);
            pb.set_style(style);
            pb
        }
        else {
            // Otherwise, just a simple spinner
            let pb = ProgressBar::new_spinner();
            pb.set_draw_target(target);
            pb
        }
    }
fn progress_bar ( & self , total_size : Option < u64 > ) -> ProgressBar { // No progress bar for quiet mode. if self . quiet { return ProgressBar :: hidden ( ) ; } // We want to limit refreshes to once per second, so we have to make a // new draw target. let target = ProgressDrawTarget :: stderr_with_hz ( PROGRESS_UPDATE_HZ ) ; if let Some ( size ) = total_size { // If we know the total size, setup a nice bar let template = if self . no_color { PROGRESS_TEMPLATE_NO_COLOR } else { PROGRESS_TEMPLATE } ; let style = ProgressStyle :: default_bar ( ) . template ( template ) . progress_chars ( PROGRESS_CHARS ) ; let pb = ProgressBar :: with_draw_target ( size , target ) ; pb . set_style ( style ) ; pb } else { // Otherwise, just a simple spinner let pb = ProgressBar :: new_spinner ( ) ; pb . set_draw_target ( target ) ; pb } }
Handle creation of an appropriate progress bar
Handle creation of an appropriate progress bar
&self
total_size
Option<u64>
&self
total_size
Option<u64>