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>
impl Frame<Page4K>
sourcepub const fn containing_address(addr: PhysicalAddress) -> Frame
pub const fn containing_address(addr: PhysicalAddress) -> Frame
Returns the 4KiB Frame
containing the given PhysicalAddress
.
sourcepub const fn align_up(&self, alignment_4k_pages: usize) -> Frame
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
.
sourcepub const fn from_4k_into_generic<P: PageSize>(self) -> Frame<P>
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>
impl Frame<Page2M>
sourcepub const fn containing_address_2mb(addr: PhysicalAddress) -> Frame<Page2M>
pub const fn containing_address_2mb(addr: PhysicalAddress) -> Frame<Page2M>
Returns the 2MiB huge Frame
containing the given PhysicalAddress
.
sourcepub const fn from_2m_into_generic<P: PageSize>(self) -> Frame<P>
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>
impl Frame<Page1G>
sourcepub const fn containing_address_1gb(addr: PhysicalAddress) -> Frame<Page1G>
pub const fn containing_address_1gb(addr: PhysicalAddress) -> Frame<Page1G>
Returns the 1GiB huge Frame
containing the given PhysicalAddress
.
sourcepub const fn from_1g_into_generic<P: PageSize>(self) -> Frame<P>
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>
impl<P: PageSize> Frame<P>
sourcepub const fn start_address(&self) -> PhysicalAddress
pub const fn start_address(&self) -> PhysicalAddress
Returns the PhysicalAddress
at the start of this Frame
.
sourcepub const fn page_size(&self) -> MemChunkSize
pub const fn page_size(&self) -> MemChunkSize
Returns the size of this Frame
.
Trait Implementations§
source§impl<P: PageSize> AddAssign<usize> for Frame<P>
impl<P: PageSize> AddAssign<usize> for Frame<P>
source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
Performs the
+=
operation. Read moresource§impl<P: Ord + PageSize> Ord for Frame<P>
impl<P: Ord + PageSize> Ord for Frame<P>
source§impl<P: PartialEq + PageSize> PartialEq<Frame<P>> for Frame<P>
impl<P: PartialEq + PageSize> PartialEq<Frame<P>> for Frame<P>
source§impl<P: PartialOrd + PageSize> PartialOrd<Frame<P>> for Frame<P>
impl<P: PartialOrd + PageSize> PartialOrd<Frame<P>> for Frame<P>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl<P: PageSize> Step for Frame<P>
impl<P: PageSize> Step for Frame<P>
source§fn steps_between(start: &Frame<P>, end: &Frame<P>) -> Option<usize>
fn steps_between(start: &Frame<P>, end: &Frame<P>) -> Option<usize>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn forward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>
fn forward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn backward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>
fn backward_checked(start: Frame<P>, count: usize) -> Option<Frame<P>>
🔬This is a nightly-only experimental API. (
step_trait
)source§fn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§unsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§fn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§unsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
🔬This is a nightly-only experimental API. (
step_trait
)source§impl<P: PageSize> SubAssign<usize> for Frame<P>
impl<P: PageSize> SubAssign<usize> for Frame<P>
source§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
Performs the
-=
operation. Read moreimpl<P: Copy + PageSize> Copy for Frame<P>
impl<P: Eq + PageSize> Eq for Frame<P>
impl<P: PageSize> StructuralEq for Frame<P>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more