Expand description
A virtual memory page.
Implementations
sourceimpl<S: PageSize> Page<S>
impl<S: PageSize> Page<S>
sourcepub fn from_start_address(address: VirtAddr) -> Result<Self, AddressNotAligned>
pub fn from_start_address(address: VirtAddr) -> Result<Self, AddressNotAligned>
Returns the page that starts at the given virtual address.
Returns an error if the address is not correctly aligned (i.e. is not a valid page start).
sourcepub const unsafe fn from_start_address_unchecked(
start_address: VirtAddr
) -> Self
pub const unsafe fn from_start_address_unchecked(
start_address: VirtAddr
) -> Self
Returns the page that starts at the given virtual address.
Safety
The address must be correctly aligned.
sourcepub fn containing_address(address: VirtAddr) -> Self
pub fn containing_address(address: VirtAddr) -> Self
Returns the page that contains the given virtual address.
sourcepub const fn start_address(self) -> VirtAddr
pub const fn start_address(self) -> VirtAddr
Returns the start address of the page.
sourcepub const fn p4_index(self) -> PageTableIndex
pub const fn p4_index(self) -> PageTableIndex
Returns the level 4 page table index of this page.
sourcepub const fn p3_index(self) -> PageTableIndex
pub const fn p3_index(self) -> PageTableIndex
Returns the level 3 page table index of this page.
sourcepub const fn page_table_index(self, level: PageTableLevel) -> PageTableIndex
pub const fn page_table_index(self, level: PageTableLevel) -> PageTableIndex
Returns the table index of this page at the specified level.
sourcepub const fn range(start: Self, end: Self) -> PageRange<S>ⓘNotable traits for PageRange<S>impl<S: PageSize> Iterator for PageRange<S> type Item = Page<S>;
pub const fn range(start: Self, end: Self) -> PageRange<S>ⓘNotable traits for PageRange<S>impl<S: PageSize> Iterator for PageRange<S> type Item = Page<S>;
Returns a range of pages, exclusive end
.
sourcepub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S>ⓘNotable traits for PageRangeInclusive<S>impl<S: PageSize> Iterator for PageRangeInclusive<S> type Item = Page<S>;
pub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S>ⓘNotable traits for PageRangeInclusive<S>impl<S: PageSize> Iterator for PageRangeInclusive<S> type Item = Page<S>;
Returns a range of pages, inclusive end
.
sourceimpl<S: NotGiantPageSize> Page<S>
impl<S: NotGiantPageSize> Page<S>
sourcepub const fn p2_index(self) -> PageTableIndex
pub const fn p2_index(self) -> PageTableIndex
Returns the level 2 page table index of this page.
sourceimpl Page<Size1GiB>
impl Page<Size1GiB>
sourcepub fn from_page_table_indices_1gib(
p4_index: PageTableIndex,
p3_index: PageTableIndex
) -> Self
pub fn from_page_table_indices_1gib(
p4_index: PageTableIndex,
p3_index: PageTableIndex
) -> Self
Returns the 1GiB memory page with the specified page table indices.
sourceimpl Page<Size2MiB>
impl Page<Size2MiB>
sourcepub fn from_page_table_indices_2mib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex
) -> Self
pub fn from_page_table_indices_2mib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex
) -> Self
Returns the 2MiB memory page with the specified page table indices.
sourceimpl Page<Size4KiB>
impl Page<Size4KiB>
sourcepub fn from_page_table_indices(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
p1_index: PageTableIndex
) -> Self
pub fn from_page_table_indices(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
p1_index: PageTableIndex
) -> Self
Returns the 4KiB memory page with the specified page table indices.
sourcepub const fn p1_index(self) -> PageTableIndex
pub const fn p1_index(self) -> PageTableIndex
Returns the level 1 page table index of this page.
Trait Implementations
sourceimpl<S: PageSize> AddAssign<u64> for Page<S>
impl<S: PageSize> AddAssign<u64> for Page<S>
sourcefn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
Performs the +=
operation. Read more
sourceimpl<S: Ord + PageSize> Ord for Page<S>
impl<S: Ord + PageSize> Ord for Page<S>
sourceimpl<S: PartialOrd + PageSize> PartialOrd<Page<S>> for Page<S>
impl<S: PartialOrd + PageSize> PartialOrd<Page<S>> for Page<S>
sourcefn partial_cmp(&self, other: &Page<S>) -> Option<Ordering>
fn partial_cmp(&self, other: &Page<S>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
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 · sourcefn 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 more
sourceimpl<S: PageSize> Step for Page<S>
impl<S: PageSize> Step for Page<S>
sourcefn steps_between(start: &Self, end: &Self) -> Option<usize>
fn steps_between(start: &Self, end: &Self) -> Option<usize>
step_trait
)Returns the number of successor steps required to get from start
to end
. Read more
sourcefn forward_checked(start: Self, count: usize) -> Option<Self>
fn forward_checked(start: Self, count: usize) -> Option<Self>
step_trait
)Returns the value that would be obtained by taking the successor
of self
count
times. Read more
sourcefn backward_checked(start: Self, count: usize) -> Option<Self>
fn backward_checked(start: Self, count: usize) -> Option<Self>
step_trait
)Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
sourcefn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait
)Returns the value that would be obtained by taking the successor
of self
count
times. Read more
sourceunsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait
)Returns the value that would be obtained by taking the successor
of self
count
times. Read more
sourcefn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait
)Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
sourceunsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
step_trait
)Returns the value that would be obtained by taking the predecessor
of self
count
times. Read more
sourceimpl<S: PageSize> SubAssign<u64> for Page<S>
impl<S: PageSize> SubAssign<u64> for Page<S>
sourcefn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
Performs the -=
operation. Read more
impl<S: Copy + PageSize> Copy for Page<S>
impl<S: Eq + PageSize> Eq for Page<S>
impl<S: PageSize> StructuralEq for Page<S>
impl<S: PageSize> StructuralPartialEq for Page<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for Page<S> where
S: RefUnwindSafe,
impl<S> Send for Page<S> where
S: Send,
impl<S> Sync for Page<S> where
S: Sync,
impl<S> Unpin for Page<S> where
S: Unpin,
impl<S> UnwindSafe for Page<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more