Struct memory::Frame

pub struct Frame<P = Page4K>where
    P: PageSize,{ /* private fields */ }
Expand description

A Frame is a chunk of physical memory aligned to a page boundary (default 4KiB) given by the P parameter.

Implementations§

§

impl Frame<Page4K>

pub const fn containing_address(addr: PhysicalAddress) -> Frame<Page4K>

Returns the 4KiB Frame containing the given PhysicalAddress.

pub const fn align_up(&self, alignment_4k_pages: usize) -> Frame<Page4K>

Returns a new Frame that is aligned up from this Frame to the nearest multiple of alignment_4k_pages.

pub const fn from_4k_into_generic<P>(self) -> Frame<P>where P: PageSize,

Converts a known 4K-sized Frame into a Frame<P> with a generic PageSize parameter.

§

impl Frame<Page2M>

pub const fn containing_address_2mb(addr: PhysicalAddress) -> Frame<Page2M>

Returns the 2MiB huge Frame containing the given PhysicalAddress.

pub const fn from_2m_into_generic<P>(self) -> Frame<P>where P: PageSize,

Converts a known 2M-sized Frame into a Frame<P> with a generic PageSize parameter.

§

impl Frame<Page1G>

pub const fn containing_address_1gb(addr: PhysicalAddress) -> Frame<Page1G>

Returns the 1GiB huge Frame containing the given PhysicalAddress.

pub const fn from_1g_into_generic<P>(self) -> Frame<P>where P: PageSize,

Converts a known 1G-sized Frame into a Frame<P> with a generic PageSize parameter.

§

impl<P> Frame<P>where P: PageSize,

pub const MIN: Frame<P> = _

The minimum (smallest) valid value a Frame can have.

pub const MAX: Frame<P> = _

The maximum (largest) valid value a Frame can have.

pub const fn number(&self) -> usize

Returns the 4K-sized number of this Frame.

pub const fn start_address(&self) -> PhysicalAddress

Returns the PhysicalAddress at the start of this Frame.

pub const fn page_size(&self) -> MemChunkSize

Returns the size of this Frame.

Trait Implementations§

§

impl<P> Add<usize> for Frame<P>where P: PageSize,

§

type Output = Frame<P>

The resulting type after applying the + operator.
§

fn add(self, rhs: usize) -> Frame<P>

Performs the + operation. Read more
§

impl<P> AddAssign<usize> for Frame<P>where P: PageSize,

§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
§

impl<P> Clone for Frame<P>where P: Clone + PageSize,

§

fn clone(&self) -> Frame<P>

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
§

impl<P> Debug for Frame<P>where P: PageSize,

§

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

Formats the value using the given formatter. Read more
§

impl From<Frame<Page1G>> for Frame<Page4K>

§

fn from(p: Frame<Page1G>) -> Frame<Page4K>

Converts to this type from the input type.
§

impl From<Frame<Page2M>> for Frame<Page4K>

§

fn from(p: Frame<Page2M>) -> Frame<Page4K>

Converts to this type from the input type.
§

impl<P> Ord for Frame<P>where P: Ord + PageSize,

§

fn cmp(&self, other: &Frame<P>) -> 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<Self>,

Restrict a value to a certain interval. Read more
§

impl<P> PartialEq<Frame<P>> for Frame<P>where P: PartialEq<P> + PageSize,

§

fn eq(&self, other: &Frame<P>) -> 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.
§

impl<P> PartialOrd<Frame<P>> for Frame<P>where P: PartialOrd<P> + PageSize,

§

fn partial_cmp(&self, other: &Frame<P>) -> 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
§

impl<P> Step for Frame<P>where P: PageSize,

§

fn steps_between(start: &Frame<P>, end: &Frame<P>) -> Option<usize>

🔬This is a nightly-only experimental API. (step_trait)
Returns the number of successor steps required to get from start to end. Read more
§

fn forward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
§

fn backward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

fn forward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

unsafe fn forward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the successor of self count times. Read more
source§

fn backward(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
source§

unsafe fn backward_unchecked(start: Self, count: usize) -> Self

🔬This is a nightly-only experimental API. (step_trait)
Returns the value that would be obtained by taking the predecessor of self count times. Read more
§

impl<P> Sub<usize> for Frame<P>where P: PageSize,

§

type Output = Frame<P>

The resulting type after applying the - operator.
§

fn sub(self, rhs: usize) -> Frame<P>

Performs the - operation. Read more
§

impl<P> SubAssign<usize> for Frame<P>where P: PageSize,

§

fn sub_assign(&mut self, rhs: usize)

Performs the -= operation. Read more
§

impl TryFrom<Frame<Page4K>> for Frame<Page1G>

§

type Error = &'static str

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

fn try_from(p: Frame<Page4K>) -> Result<Frame<Page1G>, &'static str>

Performs the conversion.
§

impl TryFrom<Frame<Page4K>> for Frame<Page2M>

§

type Error = &'static str

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

fn try_from(p: Frame<Page4K>) -> Result<Frame<Page2M>, &'static str>

Performs the conversion.
§

impl<P> Copy for Frame<P>where P: Copy + PageSize,

§

impl<P> Eq for Frame<P>where P: Eq + PageSize,

§

impl<P> StructuralEq for Frame<P>where P: PageSize,

§

impl<P> StructuralPartialEq for Frame<P>where P: PageSize,

Auto Trait Implementations§

§

impl<P> RefUnwindSafe for Frame<P>where P: RefUnwindSafe,

§

impl<P> Send for Frame<P>where P: Send,

§

impl<P> Sync for Frame<P>where P: Sync,

§

impl<P> Unpin for Frame<P>where P: Unpin,

§

impl<P> UnwindSafe for Frame<P>where P: UnwindSafe,

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> 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, 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.