pub struct Bit(pub u64);Expand description
The basic unit of information.
Tuple Fields§
§0: u64Implementations§
Source§impl Bit
impl Bit
Sourcepub const MAX_STRING_LEN: usize = 24usize
pub const MAX_STRING_LEN: usize = 24usize
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 Bit
impl<'a> Deserialize<'a> for Bit
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 Bit
impl RefUnwindSafe for Bit
impl Send for Bit
impl Sync for Bit
impl Unpin for Bit
impl UnsafeUnpin for Bit
impl UnwindSafe for Bit
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