Struct BinaryBytes

struct BinaryBytes(153)

Formats bytes for human readability using ISO/IEC prefixes

Examples

# use indicatif::BinaryBytes;
assert_eq!("15 B",     format!("{}", BinaryBytes(15)));
assert_eq!("1.46 KiB", format!("{}", BinaryBytes(1_500)));
assert_eq!("1.43 MiB", format!("{}", BinaryBytes(1_500_000)));
assert_eq!("1.40 GiB", format!("{}", BinaryBytes(1_500_000_000)));
assert_eq!("1.36 TiB", format!("{}", BinaryBytes(1_500_000_000_000)));
assert_eq!("1.33 PiB", format!("{}", BinaryBytes(1_500_000_000_000_000)));

Implementations

impl Debug for BinaryBytes

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

impl Display for BinaryBytes

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

impl Freeze for BinaryBytes

impl RefUnwindSafe for BinaryBytes

impl Send for BinaryBytes

impl Sync for BinaryBytes

impl Unpin for BinaryBytes

impl UnsafeUnpin for BinaryBytes

impl UnwindSafe for BinaryBytes

impl<T> Any for BinaryBytes

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for BinaryBytes

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for BinaryBytes

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

impl<T> From for BinaryBytes

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToString for BinaryBytes

fn to_string(self: &Self) -> String

impl<T, U> Into for BinaryBytes

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for BinaryBytes

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

impl<T, U> TryInto for BinaryBytes

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