[−][src]Enum byte_unit::ByteUnit
The unit of bytes.
Variants
B1 B = 1 byte
KB1 KB = 1000 bytes
KiB1 KiB = 1024 bytes
MB1 MB = 1000000 bytes
MiB1 MiB = 1048576 bytes
GB1 GB = 1000000000 bytes
GiB1 GiB = 1073741824 bytes
TB1 TB = 1000000000000 bytes
TiB1 TiB = 1099511627776 bytes
PB1 PB = 1000000000000000 bytes
PiB1 PiB = 1125899906842624 bytes
Methods
impl ByteUnit[src]
pub fn from_str<S: AsRef<str>>(unit: S) -> Result<ByteUnit, ByteError>[src]
Get an instance of ByteUnit from a string slice.
extern crate byte_unit; use byte_unit::ByteUnit; assert_eq!(ByteUnit::B, ByteUnit::from_str("").unwrap()); assert_eq!(ByteUnit::B, ByteUnit::from_str("b").unwrap()); assert_eq!(ByteUnit::B, ByteUnit::from_str("B").unwrap()); assert_eq!(ByteUnit::KB, ByteUnit::from_str("k").unwrap()); assert_eq!(ByteUnit::KB, ByteUnit::from_str("K").unwrap()); assert_eq!(ByteUnit::KiB, ByteUnit::from_str("Kib").unwrap()); assert_eq!(ByteUnit::MB, ByteUnit::from_str("mb").unwrap()); assert_eq!(ByteUnit::MiB, ByteUnit::from_str("mib").unwrap()); assert_eq!(ByteUnit::GB, ByteUnit::from_str("GB").unwrap()); assert_eq!(ByteUnit::GiB, ByteUnit::from_str("GiB").unwrap()); assert_eq!(ByteUnit::TB, ByteUnit::from_str("TB").unwrap()); assert_eq!(ByteUnit::TiB, ByteUnit::from_str("TIB").unwrap()); assert_eq!(ByteUnit::PB, ByteUnit::from_str("PB").unwrap()); assert_eq!(ByteUnit::PiB, ByteUnit::from_str("PiB").unwrap());
Trait Implementations
impl Copy for ByteUnit[src]
impl PartialEq<ByteUnit> for ByteUnit[src]
fn eq(&self, other: &ByteUnit) -> bool[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> boolThis method tests for !=.
impl Eq for ByteUnit[src]
impl Clone for ByteUnit[src]
fn clone(&self) -> ByteUnit[src]
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Debug for ByteUnit[src]
impl Display for ByteUnit[src]
impl Hash for ByteUnit[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> From for T[src]
impl<T, U> Into for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T> Borrow for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T, U> TryInto for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,