Struct memory_structs::Frame

source ·
pub struct Frame<P: PageSize = Page4K> { /* 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§

source§

impl Frame<Page4K>

source

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

Returns the 4KiB Frame containing the given PhysicalAddress.

source

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

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

source

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

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

source§

impl Frame<Page2M>

source

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

Returns the 2MiB huge Frame containing the given PhysicalAddress.

source

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

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

source§

impl Frame<Page1G>

source

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

Returns the 1GiB huge Frame containing the given PhysicalAddress.

source

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

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

source§

impl<P: PageSize> Frame<P>

source

pub const MIN: Frame<P> = _

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

source

pub const MAX: Frame<P> = _

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

source

pub const fn number(&self) -> usize

Returns the 4K-sized number of this Frame.

source

pub const fn start_address(&self) -> PhysicalAddress

Returns the PhysicalAddress at the start of this Frame.

source

pub const fn page_size(&self) -> MemChunkSize

Returns the size of this Frame.

Trait Implementations§

source§

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

§

type Output = Frame<P>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

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

source§

fn add_assign(&mut self, rhs: usize)

Performs the += operation. Read more
source§

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

source§

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
source§

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

source§

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

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

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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
source§

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

source§

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.
source§

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

source§

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
source§

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

source§

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
source§

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
source§

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
source§

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

§

type Output = Frame<P>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

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

source§

fn sub_assign(&mut self, rhs: usize)

Performs the -= operation. Read more
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

source§

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

source§

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

source§

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

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