[−][src]Struct pbr::MultiBar
Implementations
impl MultiBar<Stdout>
[src]
pub fn new() -> MultiBar<Stdout>
[src]
Create a new MultiBar with stdout as a writer.
Examples
use std::thread; use pbr::MultiBar; let mut mb = MultiBar::new(); mb.println("Application header:"); let mut p1 = mb.create_bar(count); let _ = thread::spawn(move || { for _ in 0..count { p1.inc(); thread::sleep(Duration::from_millis(100)); } // notify the multibar that this bar finished. p1.finish(); }); mb.println("add a separator between the two bars"); let mut p2 = mb.create_bar(count * 2); let _ = thread::spawn(move || { for _ in 0..count * 2 { p2.inc(); thread::sleep(Duration::from_millis(100)); } // notify the multibar that this bar finished. p2.finish(); }); // start listen to all bars changes. // this is a blocking operation, until all bars will finish. // to ignore blocking, you can run it in a different thread. mb.listen();
impl<T: Write> MultiBar<T>
[src]
pub fn on(handle: T) -> MultiBar<T>
[src]
Create a new MultiBar with an arbitrary writer.
Examples
use pbr::MultiBar; use std::io::stderr; let mut mb = MultiBar::on(stderr()); // ... // see full example in `MultiBar::new` // ...
pub fn println(&mut self, s: &str)
[src]
println used to add text lines between the bars. for example: you could add a header to your application, or text separators between bars.
Examples
use pbr::MultiBar; let mut mb = MultiBar::new(); mb.println("Application header:"); let mut p1 = MultiBar::create_bar(count); // ... mb.println("Text line between bar1 and bar2"); let mut p2 = MultiBar::create_bar(count); // ... mb.println("Text line between bar2 and bar3"); // ... // ... mb.listen();
pub fn create_bar(&mut self, total: u64) -> ProgressBar<Pipe>
[src]
create_bar creates new ProgressBar
with Pipe
as the writer.
The ordering of the method calls is important. it means that in the first call, you get a progress bar in level 1, in the 2nd call, you get a progress bar in level 2, and so on.
ProgressBar that finish its work, must call finish()
(or finish_print
)
to notify the MultiBar
about it.
Examples
use pbr::MultiBar; let mut mb = MultiBar::new(); // progress bar in level 1 let mut p1 = MultiBar::create_bar(count1); // ... // progress bar in level 2 let mut p2 = MultiBar::create_bar(count2); // ... // progress bar in level 3 let mut p3 = MultiBar::create_bar(count3); // ... mb.listen();
pub fn listen(&mut self)
[src]
listen start listen to all bars changes.
ProgressBar
that finish its work, must call finish()
(or finish_print
)
to notify the MultiBar
about it.
This is a blocking operation and blocks until all bars will finish. To ignore blocking, you can run it in a different thread.
Examples
use pbr::MultiBar; let mut mb = MultiBar::new(); // ... // create some bars here // ... thread::spawn(move || { mb.listen(); println!("all bars done!"); }); // ...
Auto Trait Implementations
impl<T> !RefUnwindSafe for MultiBar<T>
impl<T> Send for MultiBar<T> where
T: Send,
T: Send,
impl<T> !Sync for MultiBar<T>
impl<T> Unpin for MultiBar<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for MultiBar<T>
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>,