Struct indicatif::DecimalBytes
source · pub struct DecimalBytes(pub u64);
Expand description
Formats bytes for human readability using SI prefixes
§Examples
assert_eq!("15 B", format!("{}", DecimalBytes(15)));
assert_eq!("1.50 kB", format!("{}", DecimalBytes(1_500)));
assert_eq!("1.50 MB", format!("{}", DecimalBytes(1_500_000)));
assert_eq!("1.50 GB", format!("{}", DecimalBytes(1_500_000_000)));
assert_eq!("1.50 TB", format!("{}", DecimalBytes(1_500_000_000_000)));
assert_eq!("1.50 PB", format!("{}", DecimalBytes(1_500_000_000_000_000)));
Tuple Fields§
§0: u64
Trait Implementations§
source§impl Debug for DecimalBytes
impl Debug for DecimalBytes
Auto Trait Implementations§
impl Freeze for DecimalBytes
impl RefUnwindSafe for DecimalBytes
impl Send for DecimalBytes
impl Sync for DecimalBytes
impl Unpin for DecimalBytes
impl UnwindSafe for DecimalBytes
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