pub struct MemoryDataSize {
    pub octets: f64,
}
Expand description

The Data struct can be used to deal with computer information in a common way. Common legacy and SI units are supported.

Example

Fields§

§octets: f64

Number of octets

Implementations§

source§

impl MemoryDataSize

source

pub const OCTET_BIT_FACTOR: f64 = 0.125f64

source

pub const OCTET_KILOOCTET_FACTOR: u64 = 1_000u64

source

pub const OCTET_MEGAOCTET_FACTOR: u64 = 1_000_000u64

source

pub const OCTET_GIGAOCTET_FACTOR: u64 = 1_000_000_000u64

source

pub const OCTET_TERAOCTET_FACTOR: u64 = 1_000_000_000_000u64

source

pub const OCTET_KIBIOCTET_FACTOR: u64 = 1_024u64

source

pub const OCTET_MEBIOCTET_FACTOR: u64 = 1_048_576u64

source

pub const OCTET_GIBIOCTET_FACTOR: u64 = 1_073_741_824u64

source

pub const OCTET_TEBIOCTET_FACTOR: u64 = 1_099_511_627_776u64

source

pub const fn from_octets(octets: f64) -> Self

Create new Data from floating point value in Octets

source

pub fn from_bits(bits: f64) -> Self

Create new Data from floating point value in Bits

source

pub const fn from_kilooctets(kilooctets: u64) -> Self

Create new Data from floating point value in Kilooctets (1000 octets)

source

pub const fn from_megaoctets(megaoctets: u64) -> Self

Create new Data from floating point value in Megaoctets (1e6 octets)

source

pub const fn from_gigaoctets(gigaoctets: u64) -> Self

Create new Data from floating point value in Gigaoctets (1e9 octets)

source

pub const fn from_teraoctets(teraoctets: u64) -> Self

Create new Data from floating point value in Teraoctets (1e12 octets)

source

pub const fn from_kibioctets(kibioctets: u64) -> Self

Create new Data from floating point value in Kibioctets (1024 octets)

source

pub const fn from_mebioctets(mebioctets: u64) -> Self

Create new Data from floating point value in Mebioctets (1024**2 octets)

source

pub const fn from_gibioctets(gibioctets: u64) -> Self

Create new Data from floating point value in Gibioctets (1024**3 octets)

source

pub const fn from_tebioctets(tebioctets: u64) -> Self

Create new Data from floating point value in Tebioctets (1024**4 octets)

source

pub fn as_octets(&self) -> f64

Convert this Data to a floating point value in Octets

source

pub fn as_bits(&self) -> f64

Convert this Data to a floating point value in Bits

source

pub fn as_kilooctets(&self) -> f64

Convert this Data to a floating point value in Kilooctets (1000 octets)

source

pub fn as_megaoctets(&self) -> f64

Convert this Data to a floating point value in Megaoctets (1e6 octets)

source

pub fn as_gigaoctets(&self) -> f64

Convert this Data to a floating point value in Gigaoctets (1e9 octets)

source

pub fn as_teraoctets(&self) -> f64

Convert this Data to a floating point value in Teraoctets (1e12 octets)

source

pub fn as_kibioctets(&self) -> f64

Convert this Data to a floating point value in Kibioctets (1024 octets)

source

pub fn as_mebioctets(&self) -> f64

Convert this Data to a floating point value in Mebioctets (1024**2 octets)

source

pub fn as_gibioctets(&self) -> f64

Convert this Data to a floating point value in Gibioctets (1024**3 octets)

source

pub fn as_tebioctets(&self) -> f64

Convert this Data to a floating point value in Tebioctets (1024**4 octets)

source

pub fn as_bytes(&self) -> usize

source

pub fn from_bytes(bytes: usize) -> Self

source

pub fn max(self, other: Self) -> Self

Trait Implementations§

source§

impl Add<MemoryDataSize> for MemoryDataSize

§

type Output = MemoryDataSize

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl Clone for MemoryDataSize

source§

fn clone(&self) -> MemoryDataSize

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 MemoryDataSize

source§

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

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

impl Display for MemoryDataSize

source§

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

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

impl Div<MemoryDataSize> for MemoryDataSize

§

type Output = f64

The resulting type after applying the / operator.
source§

fn div(self, rhs: Self) -> f64

Performs the / operation. Read more
source§

impl Div<f64> for MemoryDataSize

§

type Output = MemoryDataSize

The resulting type after applying the / operator.
source§

fn div(self, rhs: f64) -> Self

Performs the / operation. Read more
source§

impl Mul<MemoryDataSize> for f64

§

type Output = MemoryDataSize

The resulting type after applying the * operator.
source§

fn mul(self, rhs: MemoryDataSize) -> MemoryDataSize

Performs the * operation. Read more
source§

impl Mul<f64> for MemoryDataSize

§

type Output = MemoryDataSize

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f64) -> Self

Performs the * operation. Read more
source§

impl PartialEq<MemoryDataSize> for MemoryDataSize

source§

fn eq(&self, other: &Self) -> 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<MemoryDataSize> for MemoryDataSize

source§

fn partial_cmp(&self, other: &Self) -> 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 Sub<MemoryDataSize> for MemoryDataSize

§

type Output = MemoryDataSize

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl Copy for MemoryDataSize

source§

impl Eq for MemoryDataSize

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V