gix_features::progress::unit::human

Struct Human

Source
pub struct Human {
    pub name: &'static str,
    pub formatter: Formatter,
}
Available on crate features progress and unit-human only.
Expand description

A helper for formatting numbers in a format easily read by humans in renderers, as in 2.54 million objects

Fields§

§name: &'static str

The name of the represented unit, like ‘items’ or ‘objects’.

§formatter: Formatter

The formatter to format the actual numbers.

Implementations§

Source§

impl Human

Source

pub fn new(formatter: Formatter, name: &'static str) -> Human

A convenience method to create a new new instance and its formatter and name fields.

Trait Implementations§

Source§

impl Debug for Human

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl DisplayValue for Human

Source§

fn display_current_value( &self, w: &mut dyn Write, value: usize, _upper: Option<usize>, ) -> Result<(), Error>

Display the absolute value representing the current progress of an operation and write it to w. Read more
Source§

fn display_upper_bound( &self, w: &mut dyn Write, upper_bound: usize, _value: usize, ) -> Result<(), Error>

Emit the upper_bound to w. Read more
Source§

fn dyn_hash(&self, state: &mut dyn Hasher)

A way to hash our state without using generics. Read more
Source§

fn display_unit(&self, w: &mut dyn Write, _value: usize) -> Result<(), Error>

Emit the unit of value to w. Read more
Source§

fn separator( &self, w: &mut dyn Write, _value: usize, _upper: Option<usize>, ) -> Result<(), Error>

Emit a token to separate two values. Read more
Source§

fn display_percentage( &self, w: &mut dyn Write, percentage: f64, ) -> Result<(), Error>

Emit percentage to w.
Source§

fn display_throughput( &self, w: &mut dyn Write, throughput: &Throughput, ) -> Result<(), Error>

Emit the throughput of an operation to w.
Source§

fn fraction_and_time_unit( &self, timespan: Duration, ) -> (Option<f64>, &'static str)

Given a timespan, return a fraction of the timespan based on the given unit, i.e. (possible fraction, unit).

Auto Trait Implementations§

§

impl Freeze for Human

§

impl RefUnwindSafe for Human

§

impl Send for Human

§

impl Sync for Human

§

impl Unpin for Human

§

impl UnwindSafe for Human

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.