pub enum ByteUnit {
Show 13 variants
Byte,
Kilobyte,
Kibibyte,
Megabyte,
Mebibyte,
Gigabyte,
Gibibyte,
Terabyte,
Tebibyte,
Petabyte,
Pebibyte,
Exabyte,
Exbibyte,
}
Expand description
A byte unit like Megabyte (MB) or Kibibyte (KiB).
Variants§
Byte
Base unit of one byte.
Kilobyte
1 kB is 10u64.pow(3)
bytes.
Kibibyte
1 KiB is 1 << 10
bytes.
Megabyte
1 MB is 10u64.pow(6)
bytes.
Mebibyte
1 MiB is 1 << 20
bytes.
Gigabyte
1 GB is 10u64.pow(9)
bytes.
Gibibyte
1 GiB is 1 << 30
bytes.
Terabyte
1 TB is 10u64.pow(12)
bytes.
Tebibyte
1 TiB is 1 << 40
bytes.
Petabyte
1 PB is 10u64.pow(15)
bytes.
Pebibyte
1 PiB is 1 << 50
bytes.
Exabyte
1 EB is 10u64.pow(18)
bytes.
Exbibyte
1 EiB is 1 << 60
bytes.
Implementations§
Source§impl ByteUnit
impl ByteUnit
Sourcepub const fn parse_ascii(ascii: &[u8]) -> Result<Self, ByteUnitParseError>
pub const fn parse_ascii(ascii: &[u8]) -> Result<Self, ByteUnitParseError>
Parse the string representation of a unit (case insensitive).
Sourcepub const fn parse_str(string: &str) -> Result<Self, ByteUnitParseError>
pub const fn parse_str(string: &str) -> Result<Self, ByteUnitParseError>
Parse the string representation of the unit (case insensitive).
Trait Implementations§
Source§impl Ord for ByteUnit
impl Ord for ByteUnit
Source§impl PartialOrd for ByteUnit
impl PartialOrd for ByteUnit
impl Copy for ByteUnit
impl Eq for ByteUnit
impl StructuralPartialEq for ByteUnit
Auto Trait Implementations§
impl Freeze for ByteUnit
impl RefUnwindSafe for ByteUnit
impl Send for ByteUnit
impl Sync for ByteUnit
impl Unpin for ByteUnit
impl UnwindSafe for ByteUnit
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