[][src]Struct os_units::Size

#[repr(transparent)]pub struct Size<T: Unit> { /* fields omitted */ }

A struct containing the value with the unit specified by generic type.

Implementations

impl<T: Unit> Size<T>[src]

pub fn new(val: usize) -> Self[src]

Creates a new instance with given value.

pub fn as_usize(self) -> usize[src]

Returns the value.

impl Size<Bytes>[src]

pub fn as_num_of_pages<T: PageSize>(self) -> Size<NumOfPages<T>>[src]

Converts bytes to the number of physical pages. Note that the number of physical pages will be calculated so that the specified bytes will be fit in pages.

impl<T: PageSize> Size<NumOfPages<T>>[src]

pub fn as_bytes(self) -> Size<Bytes>[src]

Convert the number of physical pages to bytes.

Trait Implementations

impl Add<Size<Bytes>> for Size<Bytes>[src]

type Output = Size<Bytes>

The resulting type after applying the + operator.

impl<T: PageSize> Add<Size<NumOfPages<T>>> for Size<NumOfPages<T>>[src]

type Output = Size<NumOfPages<T>>

The resulting type after applying the + operator.

impl AddAssign<Size<Bytes>> for Size<Bytes>[src]

impl<T: PageSize> AddAssign<Size<NumOfPages<T>>> for Size<NumOfPages<T>>[src]

impl<T: Clone + Unit> Clone for Size<T>[src]

impl<T: Copy + Unit> Copy for Size<T>[src]

impl<T: Debug + Unit> Debug for Size<T>[src]

impl<T: Eq + Unit> Eq for Size<T>[src]

impl<T: Ord + Unit> Ord for Size<T>[src]

impl<T: PartialEq + Unit> PartialEq<Size<T>> for Size<T>[src]

impl<T: PartialOrd + Unit> PartialOrd<Size<T>> for Size<T>[src]

impl<T: Unit> StructuralEq for Size<T>[src]

impl<T: Unit> StructuralPartialEq for Size<T>[src]

impl Sub<Size<Bytes>> for Size<Bytes>[src]

type Output = Size<Bytes>

The resulting type after applying the - operator.

impl<T: PageSize> Sub<Size<NumOfPages<T>>> for Size<NumOfPages<T>>[src]

type Output = Size<NumOfPages<T>>

The resulting type after applying the - operator.

impl SubAssign<Size<Bytes>> for Size<Bytes>[src]

impl<T: PageSize> SubAssign<Size<NumOfPages<T>>> for Size<NumOfPages<T>>[src]

Auto Trait Implementations

impl<T> Send for Size<T>

impl<T> Sync for Size<T>

impl<T> Unpin for Size<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.