Struct sysutil::ByteSize

source ·
pub struct ByteSize { /* private fields */ }
Expand description

Bytes size data structure implementing methods to convert in various size orders The methods allow the convertion in the various size orders, both in base 1000 and base 1024

let byteSize = /* some sysutil function returning ByteSize */ ;
byteSize.b(); // bytes

byteSize.kb(); // 1000 bytes
byteSize.kib(); // 1024 bytes

byteSize.mb(); // 1.000.000 bytes
byteSize.mib(); // 1.048.576 bytes

byteSize.gb(); // 1.000.000.000 bytes
byteSize.gib(); //1.073.741.824 bytes

byteSize.tb(); // 1.000.000.000.000 bytes
byteSize.tib(); // 1.099.511.627.776 bytes

Implementations§

source§

impl ByteSize

source

pub fn b(&self) -> usize

source

pub fn kb(&self) -> f32

source

pub fn mb(&self) -> f32

source

pub fn gb(&self) -> f32

source

pub fn tb(&self) -> f32

source

pub fn kib(&self) -> f32

source

pub fn mib(&self) -> f32

source

pub fn gib(&self) -> f32

source

pub fn tib(&self) -> f32

Trait Implementations§

source§

impl Debug for ByteSize

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.