Struct indicatif::HumanBytes
source · pub struct HumanBytes(pub u64);
Expand description
Formats bytes for human readability
§Examples
assert_eq!("15 B", format!("{}", HumanBytes(15)));
assert_eq!("1.46 KiB", format!("{}", HumanBytes(1_500)));
assert_eq!("1.43 MiB", format!("{}", HumanBytes(1_500_000)));
assert_eq!("1.40 GiB", format!("{}", HumanBytes(1_500_000_000)));
assert_eq!("1.36 TiB", format!("{}", HumanBytes(1_500_000_000_000)));
assert_eq!("1.33 PiB", format!("{}", HumanBytes(1_500_000_000_000_000)));
Tuple Fields§
§0: u64
Trait Implementations§
source§impl Debug for HumanBytes
impl Debug for HumanBytes
Auto Trait Implementations§
impl Freeze for HumanBytes
impl RefUnwindSafe for HumanBytes
impl Send for HumanBytes
impl Sync for HumanBytes
impl Unpin for HumanBytes
impl UnwindSafe for HumanBytes
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