pub struct BSize<T: Unsigned>(pub T);Expand description
Byte size representation.
Tuple Fields§
§0: TImplementations§
Source§impl BSize<u32>
impl BSize<u32>
Source§impl BSize<u64>
impl BSize<u64>
Sourcepub const fn kib(size: u64) -> Self
pub const fn kib(size: u64) -> Self
Constructs a byte size wrapper from a quantity of kib units.
Sourcepub const fn mib(size: u64) -> Self
pub const fn mib(size: u64) -> Self
Constructs a byte size wrapper from a quantity of mib units.
Sourcepub const fn gib(size: u64) -> Self
pub const fn gib(size: u64) -> Self
Constructs a byte size wrapper from a quantity of gib units.
Sourcepub const fn tib(size: u64) -> Self
pub const fn tib(size: u64) -> Self
Constructs a byte size wrapper from a quantity of tib units.
Source§impl BSize<usize>
impl BSize<usize>
Sourcepub const fn mb(size: usize) -> Self
pub const fn mb(size: usize) -> Self
Constructs a byte size wrapper from a quantity of mb units.
Sourcepub const fn mib(size: usize) -> Self
pub const fn mib(size: usize) -> Self
Constructs a byte size wrapper from a quantity of mib units.
Source§impl BSize<usize>
impl BSize<usize>
Sourcepub const fn tb(size: usize) -> Self
pub const fn tb(size: usize) -> Self
Constructs a byte size wrapper from a quantity of tb units.
Sourcepub const fn tib(size: usize) -> Self
pub const fn tib(size: usize) -> Self
Constructs a byte size wrapper from a quantity of tib units.
Sourcepub const fn pb(size: usize) -> Self
pub const fn pb(size: usize) -> Self
Constructs a byte size wrapper from a quantity of pb units.
Sourcepub const fn pib(size: usize) -> Self
pub const fn pib(size: usize) -> Self
Constructs a byte size wrapper from a quantity of pib units.
Source§impl BSize<u32>
impl BSize<u32>
Sourcepub fn as_kb(&self) -> f64
pub fn as_kb(&self) -> f64
Returns byte count as kilobytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_kib(&self) -> f64
pub fn as_kib(&self) -> f64
Returns byte count as kibibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_mb(&self) -> f64
pub fn as_mb(&self) -> f64
Returns byte count as megabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_mib(&self) -> f64
pub fn as_mib(&self) -> f64
Returns byte count as mebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Source§impl BSize<u64>
impl BSize<u64>
Sourcepub fn as_kb(&self) -> f64
pub fn as_kb(&self) -> f64
Returns byte count as kilobytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_kib(&self) -> f64
pub fn as_kib(&self) -> f64
Returns byte count as kibibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_mb(&self) -> f64
pub fn as_mb(&self) -> f64
Returns byte count as megabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_mib(&self) -> f64
pub fn as_mib(&self) -> f64
Returns byte count as mebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_gb(&self) -> f64
pub fn as_gb(&self) -> f64
Returns byte count as gigabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_gib(&self) -> f64
pub fn as_gib(&self) -> f64
Returns byte count as gibibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_tb(&self) -> f64
pub fn as_tb(&self) -> f64
Returns byte count as terabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_tib(&self) -> f64
pub fn as_tib(&self) -> f64
Returns byte count as tebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_pb(&self) -> f64
pub fn as_pb(&self) -> f64
Returns byte count as petabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_pib(&self) -> f64
pub fn as_pib(&self) -> f64
Returns byte count as pebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Source§impl BSize<usize>
impl BSize<usize>
Sourcepub fn as_mb(&self) -> f64
pub fn as_mb(&self) -> f64
Returns byte count as megabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_mib(&self) -> f64
pub fn as_mib(&self) -> f64
Returns byte count as mebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Source§impl BSize<usize>
impl BSize<usize>
Sourcepub fn as_tb(&self) -> f64
pub fn as_tb(&self) -> f64
Returns byte count as terabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_tib(&self) -> f64
pub fn as_tib(&self) -> f64
Returns byte count as tebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_pb(&self) -> f64
pub fn as_pb(&self) -> f64
Returns byte count as petabytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Sourcepub fn as_pib(&self) -> f64
pub fn as_pib(&self) -> f64
Returns byte count as pebibytes.
The result is approximate when the byte count cannot be
represented exactly as f64.
Trait Implementations§
impl<T: Copy + Unsigned> Copy for BSize<T>
Source§impl<'de> Deserialize<'de> for BSize<u8>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BSize<u8>
serde only.Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserialize<'de> for BSize<u16>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BSize<u16>
serde only.Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserialize<'de> for BSize<u32>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BSize<u32>
serde only.Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserialize<'de> for BSize<u64>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BSize<u64>
serde only.Source§fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(de: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<'de> Deserialize<'de> for BSize<usize>
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BSize<usize>
serde only.