[−][src]Struct pbr::ProgressBar
Fields
total: u64is_finish: boolis_multibar: boolshow_bar: boolshow_speed: boolshow_percent: boolshow_counter: boolshow_time_left: boolshow_tick: boolshow_message: boolImplementations
impl ProgressBar<Stdout>[src]
pub fn new(total: u64) -> ProgressBar<Stdout>[src]
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); }
impl<T: Write> ProgressBar<T>[src]
pub fn on(handle: T, total: u64) -> ProgressBar<T>[src]
Create a new ProgressBar with default configuration but pass an arbitrary writer.
Examples
use std::thread; use std::io::stderr; use pbr::{ProgressBar, Units}; let count = 1000; let mut pb = ProgressBar::on(stderr(), count); pb.set_units(Units::Bytes); for _ in 0..count { pb.inc(); thread::sleep_ms(100); }
pub fn set_units(&mut self, u: Units)[src]
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);
pub fn format(&mut self, fmt: &str)[src]
Set custom format to the drawing bar, default is [=>-]
Examples
let mut pb = ProgressBar::new(...); pb.format("[=>_]");
pub fn message(&mut self, message: &str)[src]
Set message to display in the prefix, call with "" to stop printing a message.
All newlines are replaced with spaces.
Examples
let mut pb = ProgressBar::new(20); for x in 0..20 { match x { 0 => pb.message("Doing 1st Quarter"), 5 => pb.message("Doing 2nd Quarter"), 10 => pb.message("Doing 3rd Quarter"), 15 => pb.message("Doing 4th Quarter"), } pb.inc(). }
pub fn tick_format(&mut self, tick_fmt: &str)[src]
Set tick format for the progressBar, default is \|/-
Format is not limited to 4 characters, any string can be used as a tick format (the tick will successively take the value of each char but won't loop backwards).
Examples
let mut pb = ProgressBar::new(...); pb.tick_format("▀▐▄▌")
pub fn set_width(&mut self, w: Option<usize>)[src]
Set width, or None for default.
Examples
let mut pb = ProgressBar::new(...); pb.set_width(Some(80));
pub fn set_max_refresh_rate(&mut self, w: Option<Duration>)[src]
Set max refresh rate, above which the progress bar will not redraw, or None for none.
Examples
let mut pb = ProgressBar::new(...); pb.set_max_refresh_rate(Some(Duration::from_millis(100)));
pub fn tick(&mut self)[src]
Update progress bar even though no progress are made Useful to see if a program is bricked or just not doing any progress.
tick is not needed with add or inc as performed operation take place in draw function.
Examples
let mut pb = ProgressBar::new(...); pb.inc(); for _ in ... { ...do something pb.tick(); } pb.finish();
pub fn add(&mut self, i: u64) -> u64[src]
Add to current value
Examples
use pbr::ProgressBar; let mut pb = ProgressBar::new(10); pb.add(5); pb.finish();
pub fn set(&mut self, i: u64) -> u64[src]
Manually set the current value of the bar
Examples
use pbr::ProgressBar; let mut pb = ProgressBar::new(10); pb.set(8); pb.finish();
pub fn inc(&mut self) -> u64[src]
Increment current value
pub fn finish(&mut self)[src]
Calling finish manually will set current to total and draw the last time
pub fn finish_print(&mut self, s: &str)[src]
Call finish and write string s that will replace the progress bar.
pub fn finish_println(&mut self, s: &str)[src]
Call finish and write string s below the progress bar.
If the ProgressBar is part of MultiBar instance, you should use
finish_print to print message.
Trait Implementations
impl<T: Write> Write for ProgressBar<T>[src]
fn write(&mut self, buf: &[u8]) -> Result<usize>[src]
fn flush(&mut self) -> Result<()>[src]
fn write_vectored(&mut self, bufs: &[IoSlice]) -> Result<usize, Error>1.36.0[src]
fn is_write_vectored(&self) -> bool[src]
fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>1.0.0[src]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice]) -> Result<(), Error>[src]
fn write_fmt(&mut self, fmt: Arguments) -> Result<(), Error>1.0.0[src]
fn by_ref(&mut self) -> &mut Self1.0.0[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for ProgressBar<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for ProgressBar<T> where
T: Send,
T: Send,
impl<T> Sync for ProgressBar<T> where
T: Sync,
T: Sync,
impl<T> Unpin for ProgressBar<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for ProgressBar<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,