Struct pbr::ProgressBar
[−]
[src]
pub struct ProgressBar { pub is_finish: bool, pub show_bar: bool, pub show_speed: bool, pub show_percent: bool, pub show_counter: bool, pub show_time_left: bool, // some fields omitted }
Fields
is_finish: bool
show_bar: bool
show_speed: bool
show_percent: bool
show_counter: bool
show_time_left: bool
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 n_bytes = 100; 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
use pbr::ProgressBar; 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
fn finish_print(&mut self, s: &str)
Call finish and write string 's'
Trait Implementations
impl Debug for ProgressBar
[src]
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