pub struct Style { /* private fields */ }Expand description
Progress bar style
Implementations§
Source§impl Style
impl Style
Sourcepub fn new() -> Self
pub fn new() -> Self
Default progress bar style
§Example
Create a progress bar, explicitly asking for the default style:
let style = logbar::Style::new();
let max_progress = 100;
let bar = logbar::ProgressBar::with_style(max_progress, style);Sourcepub fn width(self, width: usize) -> Self
pub fn width(self, width: usize) -> Self
Set the progress bar width in characters
§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);Sourcepub fn labels(self, labels: bool) -> Self
pub fn labels(self, labels: bool) -> Self
Toggle progress bar labels of the form XX%
§Example
Create a progress bar without labels:
let style = logbar::Style::new().labels(false);
let max_progress = 100;
let bar = logbar::ProgressBar::with_style(max_progress, style);Sourcepub fn tick(self, tick: char) -> Self
pub fn tick(self, tick: char) -> Self
Choose a “tick” character separating the progress bar segments
§Example
Create a progress bar with ‘↓’ as tick character:
let style = logbar::Style::new().tick('↓');
let max_progress = 100;
let bar = logbar::ProgressBar::with_style(max_progress, style);Sourcepub fn bar(self, bar: char) -> Self
pub fn bar(self, bar: char) -> Self
Choose a character for the progress bar segments
§Example
Create a progress bar made out of ‘-’ characters, separated by the default “tick” character.
let style = logbar::Style::new().bar('-');
let max_progress = 100;
let bar = logbar::ProgressBar::with_style(max_progress, style);Sourcepub fn indicator(self, indicator: char) -> Self
pub fn indicator(self, indicator: char) -> Self
Choose a progress indicator
§Example
Create a progress bar where the progress is indicated by the number of ‘█’ characters.
let style = logbar::Style::new().indicator('█');
let max_progress = 100;
let bar = logbar::ProgressBar::with_style(max_progress, style);Trait Implementations§
Source§impl Ord for Style
impl Ord for Style
Source§impl PartialOrd for Style
impl PartialOrd for Style
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more