[−][src]Struct os_units::Size
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]
Trait Implementations
impl Add<Size<Bytes>> for Size<Bytes>
[src]
type Output = Size<Bytes>
The resulting type after applying the +
operator.
fn add(self, rhs: Size<Bytes>) -> Self
[src]
impl<T: PageSize> Add<Size<NumOfPages<T>>> for Size<NumOfPages<T>>
[src]
type Output = Size<NumOfPages<T>>
The resulting type after applying the +
operator.
fn add(self, rhs: Size<NumOfPages<T>>) -> Self
[src]
impl AddAssign<Size<Bytes>> for Size<Bytes>
[src]
fn add_assign(&mut self, rhs: Size<Bytes>)
[src]
impl<T: PageSize> AddAssign<Size<NumOfPages<T>>> for Size<NumOfPages<T>>
[src]
fn add_assign(&mut self, rhs: Size<NumOfPages<T>>)
[src]
impl<T: Clone + Unit> Clone for Size<T>
[src]
fn clone(&self) -> Size<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn cmp(&self, other: &Size<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: PartialEq + Unit> PartialEq<Size<T>> for Size<T>
[src]
impl<T: PartialOrd + Unit> PartialOrd<Size<T>> for Size<T>
[src]
fn partial_cmp(&self, other: &Size<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Size<T>) -> bool
[src]
fn le(&self, other: &Size<T>) -> bool
[src]
fn gt(&self, other: &Size<T>) -> bool
[src]
fn ge(&self, other: &Size<T>) -> bool
[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.
fn sub(self, rhs: Size<Bytes>) -> Self
[src]
impl<T: PageSize> Sub<Size<NumOfPages<T>>> for Size<NumOfPages<T>>
[src]
type Output = Size<NumOfPages<T>>
The resulting type after applying the -
operator.
fn sub(self, rhs: Size<NumOfPages<T>>) -> Self
[src]
impl SubAssign<Size<Bytes>> for Size<Bytes>
[src]
fn sub_assign(&mut self, rhs: Size<Bytes>)
[src]
impl<T: PageSize> SubAssign<Size<NumOfPages<T>>> for Size<NumOfPages<T>>
[src]
fn sub_assign(&mut self, rhs: Size<NumOfPages<T>>)
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,