[−][src]Struct logbar::ProgressBar
A log-friendly progress bar
Methods
impl ProgressBar
[src]
pub fn new(max_progress: usize) -> Self
[src]
Create a new progress bar with default style
Example
let max_progress = 100; let bar = logbar::ProgressBar::new(max_progress);
pub fn with_style(max_progress: usize, style: Style) -> Self
[src]
Create a new progress bar with custom style
Example
Create a progress bar with a width of 80 characters:
let style = logbar::Style::new().width(80); let max_progress = 100; let bar = logbar::ProgressBar::with_style(max_progress, style);
pub fn style(&self) -> &Style
[src]
Get the style of the current progress bar
Example
let max_progress = 100; let bar = logbar::ProgressBar::new(max_progress); assert_eq!(bar.style(), &logbar::Style::default())
pub fn inc(&self, i: usize)
[src]
Increment the progress
This method increments the internal progress counter, up to the maximum defined during the construction of the progress bar. It then updates the progress display.
Example
let max_progress = 50; let bar = logbar::ProgressBar::new(max_progress); bar.inc(10); // Increment progress to 10 out of 50. // The progress bar is at 20% now bar.inc(10); // Increment progress to 20 out of 50. // The progress bar is at 40% now bar.inc(100); // Increment progress to 50 out of 50. // The progress bar is at 100% now
pub fn finish(&self)
[src]
Finish the progress bar
This method sets the progress to 100% and moves to the next line after the progress bar
Example
let max_progress = 50; let bar = logbar::ProgressBar::new(max_progress); bar.finish(); // The progress bar is at 100% now
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ProgressBar
impl Send for ProgressBar
impl Sync for ProgressBar
impl Unpin for ProgressBar
impl UnwindSafe for ProgressBar
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>,