pub struct Byte(pub u64);Expand description
The unit of information.
Tuple Fields§
§0: u64Implementations§
Source§impl Byte
impl Byte
Sourcepub const MAX_STRING_LEN: usize = 22usize
pub const MAX_STRING_LEN: usize = 22usize
Max. length in string form.
Sourcepub const MIN_PREFIX: Prefix = crate::iec::Prefix::None
pub const MIN_PREFIX: Prefix = crate::iec::Prefix::None
Minimum IEC prefix.
Sourcepub const MAX_PREFIX: Prefix = crate::iec::Prefix::Exbi
pub const MAX_PREFIX: Prefix = crate::iec::Prefix::Exbi
Maximum IEC prefix.
Sourcepub const fn from_iec(value: u64) -> Self
pub const fn from_iec(value: u64) -> Self
Convert from IEC value without prefix. Panics if the prefix is out of range.
Sourcepub const fn with_iec_prefix(value: u64, prefix: Prefix) -> Self
pub const fn with_iec_prefix(value: u64, prefix: Prefix) -> Self
Convert from IEC value with prefix. Panics if the prefix is out of range.
Sourcepub const fn try_with_iec_prefix(
value: u64,
prefix: Prefix,
) -> Result<Self, Error>
pub const fn try_with_iec_prefix( value: u64, prefix: Prefix, ) -> Result<Self, Error>
Convert from IEC value with prefix. Returns an error if the prefix is out of range.
Sourcepub const fn format_iec(
&self,
) -> FormattedUnit<'static, u64, { Self::MAX_STRING_LEN }>
pub const fn format_iec( &self, ) -> FormattedUnit<'static, u64, { Self::MAX_STRING_LEN }>
Represent the value as a number using the largest possible unit prefix.
Trait Implementations§
Source§impl<'a> Deserialize<'a> for Byte
impl<'a> Deserialize<'a> for Byte
Source§fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
fn deserialize<D>(d: D) -> Result<Self, D::Error>where
D: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Byte
impl RefUnwindSafe for Byte
impl Send for Byte
impl Sync for Byte
impl Unpin for Byte
impl UnsafeUnpin for Byte
impl UnwindSafe for Byte
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