Struct ubyte::ByteUnit

source ·
pub struct ByteUnit(/* private fields */);
Expand description

A unit of bytes with saturating const constructors and arithmetic.

Overview

A ByteUnit represents a unit, a count, a number, of bytes. All operations on a ByteUnit – constructors, arithmetic, conversions – saturate. Overflow, underflow, and divide-by-zero are impossible. See the top-level documentation for more.

ToByteUnit provides human-friendly methods on all integer types for converting into a ByteUnit: 512.megabytes().

Parsing

ByteUnit implements FromStr for parsing byte unit strings into a ByteUnit. The grammar accepted by the parser is:

byte_unit := uint+ ('.' uint+)? WHITESPACE* suffix

uint := '0'..'9'
suffix := case insensitive SI byte unit suffix ('b' to 'eib')
WHITESPACE := the ' ' character
use ubyte::{ByteUnit, ToByteUnit};

let one_gib: ByteUnit = "1GiB".parse().unwrap();
assert_eq!(one_gib, 1.gibibytes());

let quarter_mb: ByteUnit = "256 kB".parse().unwrap();
assert_eq!(quarter_mb, 256.kilobytes());

let half_mb: ByteUnit = "0.5MB".parse().unwrap();
assert_eq!(half_mb, 500.kilobytes());

let half_mib: ByteUnit = "0.500 mib".parse().unwrap();
assert_eq!(half_mib, 512.kibibytes());

let some_mb: ByteUnit = "20.5MB".parse().unwrap();
assert_eq!(some_mb, 20.megabytes() + 500.kilobytes());

(De)serialization

With the serde feaure enabled (disabled by default), ByteUnit implements Deserialize from strings, using the same grammar as the FromStr implementation, defined above, as well as all integer types. The Serialize implementation serializes into a u64.

Example

use ubyte::{ByteUnit, ToByteUnit};

// Construct with unit-valued associated constants, `const` constructors, or
// human-friendly methods from the `ToByteUnit` integer extension trait.
const HALF_GB: ByteUnit = ByteUnit::Megabyte(500);
const HALF_GIB: ByteUnit = ByteUnit::Mebibyte(512);
let half_gb = 500 * ByteUnit::MB;
let half_gib = 512 * ByteUnit::MiB;
let half_gb = 500.megabytes();
let half_gib = 512.mebibytes();

// All arithmetic operations and conversions saturate.
let exbibyte = ByteUnit::Exbibyte(1);
let exbibyte_too_large_a = 1024 * ByteUnit::EiB;
let exbibyte_too_large_b = ByteUnit::Exbibyte(1024);
let exbibyte_too_large_c = 1024.exbibytes();
let div_by_zero = 1024.exbibytes() / 0;
let too_small = 1000.megabytes() - 1.gibibytes();
assert_eq!(exbibyte << 4, ByteUnit::max_value());
assert_eq!(exbibyte << 10, ByteUnit::max_value());
assert_eq!(exbibyte_too_large_a, ByteUnit::max_value());
assert_eq!(exbibyte_too_large_b, ByteUnit::max_value());
assert_eq!(exbibyte_too_large_c, ByteUnit::max_value());
assert_eq!(div_by_zero, ByteUnit::max_value());
assert_eq!(too_small, 0);

Implementations§

source§

impl ByteUnit

source

pub const B: ByteUnit = _

Number of bytes in 1 B (1).

source

pub const kB: ByteUnit = _

Number of bytes in 1 kB (1_000).

source

pub const KiB: ByteUnit = _

Number of bytes in 1 KiB (1 << 10).

source

pub const MB: ByteUnit = _

Number of bytes in 1 MB (1_000_000).

source

pub const MiB: ByteUnit = _

Number of bytes in 1 MiB (1 << 20).

source

pub const GB: ByteUnit = _

Number of bytes in 1 GB (1_000_000_000).

source

pub const GiB: ByteUnit = _

Number of bytes in 1 GiB (1 << 30).

source

pub const TB: ByteUnit = _

Number of bytes in 1 TB (1_000_000_000_000).

source

pub const TiB: ByteUnit = _

Number of bytes in 1 TiB (1 << 40).

source

pub const PB: ByteUnit = _

Number of bytes in 1 PB (1_000_000_000_000_000).

source

pub const PiB: ByteUnit = _

Number of bytes in 1 PiB (1 << 50).

source

pub const EB: ByteUnit = _

Number of bytes in 1 EB (1_000_000_000_000_000_000).

source

pub const EiB: ByteUnit = _

Number of bytes in 1 EiB (1 << 60).

source

pub const fn Byte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n B .

Example
assert_eq!(ByteUnit::Byte(10), 10 * ByteUnit::B);
source

pub const fn Kilobyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n kB .

Example
assert_eq!(ByteUnit::Kilobyte(10), 10 * ByteUnit::kB);
source

pub const fn Kibibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n KiB .

Example
assert_eq!(ByteUnit::Kibibyte(10), 10 * ByteUnit::KiB);
source

pub const fn Megabyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n MB .

Example
assert_eq!(ByteUnit::Megabyte(10), 10 * ByteUnit::MB);
source

pub const fn Mebibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n MiB .

Example
assert_eq!(ByteUnit::Mebibyte(10), 10 * ByteUnit::MiB);
source

pub const fn Gigabyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n GB .

Example
assert_eq!(ByteUnit::Gigabyte(10), 10 * ByteUnit::GB);
source

pub const fn Gibibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n GiB .

Example
assert_eq!(ByteUnit::Gibibyte(10), 10 * ByteUnit::GiB);
source

pub const fn Terabyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n TB .

Example
assert_eq!(ByteUnit::Terabyte(10), 10 * ByteUnit::TB);
source

pub const fn Tebibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n TiB .

Example
assert_eq!(ByteUnit::Tebibyte(10), 10 * ByteUnit::TiB);
source

pub const fn Petabyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n PB .

Example
assert_eq!(ByteUnit::Petabyte(10), 10 * ByteUnit::PB);
source

pub const fn Pebibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n PiB .

Example
assert_eq!(ByteUnit::Pebibyte(10), 10 * ByteUnit::PiB);
source

pub const fn Exabyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n EB .

Example
assert_eq!(ByteUnit::Exabyte(10), 10 * ByteUnit::EB);
source

pub const fn Exbibyte(n: u64) -> ByteUnit

Constructs a ByteUnit representing n EiB .

Example
assert_eq!(ByteUnit::Exbibyte(10), 10 * ByteUnit::EiB);
source

pub const fn max_value() -> ByteUnit

The maximum value of bytes representable by ByteUnit.

Example
assert_eq!(ByteUnit::max_value(), u64::max_value());
source

pub const fn as_u64(self) -> u64

Returns the value of bytes represented by self as a u64.

Example
let int: u64 = ByteUnit::Gigabyte(4).as_u64();
assert_eq!(int, 4 * ByteUnit::GB);

assert_eq!(ByteUnit::Megabyte(42).as_u64(), 42 * 1_000_000);
assert_eq!(ByteUnit::Exbibyte(7).as_u64(), 7 * 1 << 60);
source

pub const fn as_u128(self) -> u128

Returns the value of bytes represented by self as a u128.

Example
let int: u128 = ByteUnit::Gigabyte(4).as_u128();
assert_eq!(int, 4 * ByteUnit::GB);

assert_eq!(ByteUnit::Megabyte(42).as_u64(), 42 * 1_000_000);
assert_eq!(ByteUnit::Exbibyte(7).as_u64(), 7 * 1 << 60);
source

pub fn repr(self) -> (u64, f64, &'static str, ByteUnit)

Returns the components of the minimal unit representation of self.

The “minimal unit representation” is the representation that maximizes the SI-unit while minimizing the whole part of the value. For example, 1024.bytes() is minimally represented by 1KiB, while 1023.bytes() is minimally represented by 1.023kB.

The four components returned, in tuple-order, are:

  • whole - the whole part of the minimal representation.
  • frac - the fractional part of the minimal representation.
  • suffix - the suffix of the minimal representation.
  • unit - the 1-unit of the minimal representation.

Succinctly, this is: (whole, frac, suffix, unit). Observe that `(whole

  • frac) * unit` reconstructs the original value.
Example
use ubyte::{ByteUnit, ToByteUnit};

let value = 2.mebibytes() + 512.kibibytes();
assert_eq!(value.to_string(), "2.50MiB");

let (whole, frac, suffix, unit) = value.repr();
assert_eq!(whole, 2);
assert_eq!(frac, 0.5);
assert_eq!(suffix, "MiB");
assert_eq!(unit, ByteUnit::MiB);

let reconstructed = (whole as f64 + frac) * unit.as_u64() as f64;
assert_eq!(reconstructed as u64, value);

Trait Implementations§

source§

impl Add<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl Add<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: ByteUnit) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Into<ByteUnit>> Add<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the + operator.
source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
source§

impl<T: Into<ByteUnit>> AddAssign<T> for ByteUnit

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl Clone for ByteUnit

source§

fn clone(&self) -> ByteUnit

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ByteUnit

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ByteUnit

source§

fn default() -> ByteUnit

Returns the “default value” for a type. Read more
source§

impl Display for ByteUnit

Display self as best as possible. For perfectly custom display output, consider using ByteUnit::repr().

Example

use ubyte::{ByteUnit, ToByteUnit};

assert_eq!(323.kilobytes().to_string(), "323kB");
assert_eq!(3.megabytes().to_string(), "3MB");
assert_eq!(3.mebibytes().to_string(), "3MiB");

assert_eq!((3.mebibytes() + 140.kilobytes()).to_string(), "3.13MiB");
assert_eq!((3.mebibytes() + 2.mebibytes()).to_string(), "5MiB");
assert_eq!((7.gigabytes() + 58.mebibytes() + 3.kilobytes()).to_string(), "7.06GB");
assert_eq!((7.gibibytes() + 920.mebibytes()).to_string(), "7.90GiB");
assert_eq!(7231.kilobytes().to_string(), "6.90MiB");

assert_eq!(format!("{:.0}", 7.gibibytes() + 920.mebibytes()), "8GiB");
assert_eq!(format!("{:.1}", 7.gibibytes() + 920.mebibytes()), "7.9GiB");
assert_eq!(format!("{:.2}", 7.gibibytes() + 920.mebibytes()), "7.90GiB");
assert_eq!(format!("{:.3}", 7.gibibytes() + 920.mebibytes()), "7.898GiB");
assert_eq!(format!("{:.4}", 7.gibibytes() + 920.mebibytes()), "7.8984GiB");
assert_eq!(format!("{:.4}", 7231.kilobytes()), "6.8960MiB");
assert_eq!(format!("{:.0}", 7231.kilobytes()), "7MiB");
assert_eq!(format!("{:.2}", 999.kilobytes() + 990.bytes()), "976.55KiB");
assert_eq!(format!("{:.0}", 999.kilobytes() + 990.bytes()), "1MB");

assert_eq!(format!("{:04.2}", 999.kilobytes() + 990.bytes()), "0976.55KiB");
assert_eq!(format!("{:02.0}", 999.kilobytes() + 990.bytes()), "01MB");
assert_eq!(format!("{:04.0}", 999.kilobytes() + 990.bytes()), "0001MB");
source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl Div<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: ByteUnit) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Into<ByteUnit>> Div<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T: Into<ByteUnit>> DivAssign<T> for ByteUnit

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl From<ByteUnit> for u128

source§

fn from(v: ByteUnit) -> Self

Converts to this type from the input type.
source§

impl From<ByteUnit> for u64

source§

fn from(v: ByteUnit) -> Self

Converts to this type from the input type.
source§

impl From<i128> for ByteUnit

source§

fn from(value: i128) -> Self

Converts to this type from the input type.
source§

impl From<i16> for ByteUnit

source§

fn from(v: i16) -> Self

Converts to this type from the input type.
source§

impl From<i32> for ByteUnit

source§

fn from(v: i32) -> Self

Converts to this type from the input type.
source§

impl From<i64> for ByteUnit

source§

fn from(v: i64) -> Self

Converts to this type from the input type.
source§

impl From<i8> for ByteUnit

source§

fn from(v: i8) -> Self

Converts to this type from the input type.
source§

impl From<isize> for ByteUnit

source§

fn from(value: isize) -> Self

Converts to this type from the input type.
source§

impl From<u128> for ByteUnit

source§

fn from(value: u128) -> Self

Converts to this type from the input type.
source§

impl From<u16> for ByteUnit

source§

fn from(v: u16) -> Self

Converts to this type from the input type.
source§

impl From<u32> for ByteUnit

source§

fn from(v: u32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for ByteUnit

source§

fn from(v: u64) -> Self

Converts to this type from the input type.
source§

impl From<u8> for ByteUnit

source§

fn from(v: u8) -> Self

Converts to this type from the input type.
source§

impl From<usize> for ByteUnit

source§

fn from(value: usize) -> Self

Converts to this type from the input type.
source§

impl FromStr for ByteUnit

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for ByteUnit

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Mul<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: ByteUnit) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Into<ByteUnit>> Mul<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T: Into<ByteUnit>> MulAssign<T> for ByteUnit

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl Ord for ByteUnit

source§

fn cmp(&self, other: &ByteUnit) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<ByteUnit> for i128

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for i16

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for i32

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for i64

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for i8

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for isize

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for u128

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for u16

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for u32

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for u64

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for u8

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<ByteUnit> for usize

source§

fn eq(&self, other: &ByteUnit) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Into<ByteUnit> + Copy> PartialEq<T> for ByteUnit

source§

fn eq(&self, other: &T) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<ByteUnit> for i128

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for i16

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for i32

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for i64

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for i8

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for isize

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for u128

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for u16

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for u32

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for u64

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for u8

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PartialOrd<ByteUnit> for usize

source§

fn partial_cmp(&self, other: &ByteUnit) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: Into<ByteUnit> + Copy> PartialOrd<T> for ByteUnit

source§

fn partial_cmp(&self, other: &T) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl Rem<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: ByteUnit) -> Self::Output

Performs the % operation. Read more
source§

impl<T: Into<ByteUnit>> Rem<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the % operator.
source§

fn rem(self, rhs: T) -> Self::Output

Performs the % operation. Read more
source§

impl<T: Into<ByteUnit>> RemAssign<T> for ByteUnit

source§

fn rem_assign(&mut self, rhs: T)

Performs the %= operation. Read more
source§

impl Shl<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl Shl<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: ByteUnit) -> Self::Output

Performs the << operation. Read more
source§

impl<T: Into<ByteUnit>> Shl<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the << operator.
source§

fn shl(self, rhs: T) -> Self::Output

Performs the << operation. Read more
source§

impl<T: Into<ByteUnit>> ShlAssign<T> for ByteUnit

source§

fn shl_assign(&mut self, rhs: T)

Performs the <<= operation. Read more
source§

impl Shr<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl Shr<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: ByteUnit) -> Self::Output

Performs the >> operation. Read more
source§

impl<T: Into<ByteUnit>> Shr<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the >> operator.
source§

fn shr(self, rhs: T) -> Self::Output

Performs the >> operation. Read more
source§

impl<T: Into<ByteUnit>> ShrAssign<T> for ByteUnit

source§

fn shr_assign(&mut self, rhs: T)

Performs the >>= operation. Read more
source§

impl Sub<ByteUnit> for i128

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for i16

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for i32

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for i64

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for i8

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for isize

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for u128

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for u16

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for u32

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for u64

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for u8

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl Sub<ByteUnit> for usize

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: ByteUnit) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Into<ByteUnit>> Sub<T> for ByteUnit

§

type Output = ByteUnit

The resulting type after applying the - operator.
source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
source§

impl<T: Into<ByteUnit>> SubAssign<T> for ByteUnit

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl Copy for ByteUnit

source§

impl Eq for ByteUnit

source§

impl StructuralEq for ByteUnit

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToByteUnit for Twhere T: Into<ByteUnit> + Copy,

source§

fn bytes(self) -> ByteUnit

Converts self to a ByteUnit representing self bytes.
source§

fn kilobytes(self) -> ByteUnit

Converts self to a ByteUnit representing self kB .
source§

fn kibibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self KiB .
source§

fn megabytes(self) -> ByteUnit

Converts self to a ByteUnit representing self MB .
source§

fn mebibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self MiB .
source§

fn gigabytes(self) -> ByteUnit

Converts self to a ByteUnit representing self GB .
source§

fn gibibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self GiB .
source§

fn terabytes(self) -> ByteUnit

Converts self to a ByteUnit representing self TB .
source§

fn tibibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self TiB .
source§

fn petabytes(self) -> ByteUnit

Converts self to a ByteUnit representing self PB .
source§

fn pebibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self PiB .
source§

fn exabytes(self) -> ByteUnit

Converts self to a ByteUnit representing self EB .
source§

fn exbibytes(self) -> ByteUnit

Converts self to a ByteUnit representing self EiB .
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.