[][src]Enum prgrs::Length

pub enum Length {
    Absolute(usize),
    Proportional(f64),
}

Use this struct to set the length of the progress bar. The lengths include the percentage count and parentheses at the end of the bar.

Proportional (better use this whenever possible)

When using the Proportional variant values below 0. are rounded to 0. and values above 1. are rounded to 1.

A value of 0. means the progress bar will have a single step.

A value of 1. will make the progress bar fit the entire width of the screen.

The proportions are calculated for each iteration, so you could change the size of the terminal while displaying a progress bar, but this still may lead to smaller glitches.

Absolute (use with care)

Careful: Values that are larger than the terminal will NOT be handled in a special manner, which will probably lead to glitches.

Values, that would make make the bar smaller than a single step however like negative values or for example 2 are ignored and the bar will have a single step.

Variants

Absolute(usize)

Used to set the absolute length of the progress bar in characters

Proportional(f64)

Used to set the length proportional to the width of your terminal

The supplied value should be between 0 and 1

Auto Trait Implementations

impl RefUnwindSafe for Length

impl Send for Length

impl Sync for Length

impl Unpin for Length

impl UnwindSafe for Length

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.