Struct pbr::ProgressBar [] [src]

pub struct ProgressBar {
    // some fields omitted
}

Methods

impl ProgressBar
[src]

fn new(total: usize) -> ProgressBar

Create a new ProgressBar with default configuration.

Examples

use std::thread;
use pbr::{ProgressBar, Units};

let count = 1000;
let mut pb = ProgressBar::new(count);
pb.set_units(Units::Bytes);

for _ in 0..count {
   pb.inc();
   thread::sleep_ms(100);
}

fn set_units(&mut self, u: Units)

set units, default is simple numbers

Examples

use pbr::{ProgressBar, Units};

let mut pb = ProgressBar::new(n_bytes);
pb.set_units(Units::Bytes);

fn format(&mut self, fmt: &str)

Set custom format to the drawing bar, default is [=>-]

Examples

let mut pb = ProgressBar::new(...);
pb.format("[=>_]");

fn add(&mut self, i: usize) -> usize

Add to current value

Examples

let mut pb = ProgressBar::new(10);
pb.add(5);
pb.finish();

fn inc(&mut self) -> usize

Increment current value

fn finish(&mut self)

Calling finish manually will set current to total and draw the last time

Trait Implementations

impl Debug for ProgressBar
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Write for ProgressBar
[src]

fn write(&mut self, buf: &[u8]) -> Result<usize>

Write a buffer into this object, returning how many bytes were written. Read more

fn flush(&mut self) -> Result<()>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

fn write_all(&mut self, buf: &[u8]) -> Result<()Error>
1.0.0

Attempts to write an entire buffer into this write. Read more

fn write_fmt(&mut self, fmt: Arguments) -> Result<()Error>
1.0.0

Writes a formatted string into this writer, returning any error encountered. Read more

fn by_ref(&mut self) -> &mut Self
1.0.0

Creates a "by reference" adaptor for this instance of Write. Read more