pub struct Page<S: PageSize = Size4KiB> { /* private fields */ }Expand description
A virtual memory page.
Implementations§
Source§impl<S: PageSize> Page<S>
impl<S: PageSize> Page<S>
Sourcepub const fn from_start_address(
address: VirtAddr,
) -> Result<Self, AddressNotAligned>
pub const 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 const fn containing_address(address: VirtAddr) -> Self
pub const 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> ⓘ
pub const fn range(start: Self, end: Self) -> PageRange<S> ⓘ
Returns a range of pages, exclusive end.
Sourcepub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S> ⓘ
pub const fn range_inclusive(start: Self, end: Self) -> PageRangeInclusive<S> ⓘ
Returns a range of pages, inclusive end.
Source§impl<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.
Source§impl Page<Size1GiB>
impl Page<Size1GiB>
Sourcepub const fn from_page_table_indices_1gib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
) -> Self
pub const fn from_page_table_indices_1gib( p4_index: PageTableIndex, p3_index: PageTableIndex, ) -> Self
Returns the 1GiB memory page with the specified page table indices.
Source§impl Page<Size2MiB>
impl Page<Size2MiB>
Sourcepub const fn from_page_table_indices_2mib(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
) -> Self
pub const 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.
Source§impl Page<Size4KiB>
impl Page<Size4KiB>
Sourcepub const fn from_page_table_indices(
p4_index: PageTableIndex,
p3_index: PageTableIndex,
p2_index: PageTableIndex,
p1_index: PageTableIndex,
) -> Self
pub const 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§
Source§impl<S: PageSize> AddAssign<u64> for Page<S>
impl<S: PageSize> AddAssign<u64> for Page<S>
Source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
+= operation. Read moreimpl<S: Copy + PageSize> Copy for Page<S>
impl<S: Eq + PageSize> Eq for Page<S>
Source§impl<S: Ord + PageSize> Ord for Page<S>
impl<S: Ord + PageSize> Ord for Page<S>
1.21.0 (const: unstable)§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<S: PartialOrd + PageSize> PartialOrd for Page<S>
impl<S: PartialOrd + PageSize> PartialOrd for Page<S>
Source§impl<S: PageSize> Step for Page<S>
Available on crate feature step_trait only.
impl<S: PageSize> Step for Page<S>
step_trait only.Source§fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>)
fn steps_between(start: &Self, end: &Self) -> (usize, Option<usize>)
step_trait)start to end
like [Iterator::size_hint()][Iterator::size_hint()]. Read moreSource§fn forward_checked(start: Self, count: usize) -> Option<Self>
fn forward_checked(start: Self, count: usize) -> Option<Self>
step_trait)Source§fn backward_checked(start: Self, count: usize) -> Option<Self>
fn backward_checked(start: Self, count: usize) -> Option<Self>
step_trait)Source§fn forward_overflowing(start: Self, count: usize) -> (Self, bool)
fn forward_overflowing(start: Self, count: usize) -> (Self, bool)
step_trait)self count times along with a boolean tracking whether overflow
occurred. Read moreSource§fn backward_overflowing(start: Self, count: usize) -> (Self, bool)
fn backward_overflowing(start: Self, count: usize) -> (Self, bool)
step_trait)self count times along with a boolean tracking whether overflow
occurred. Read more§fn forward(start: Self, count: usize) -> Self
fn forward(start: Self, count: usize) -> Self
step_trait)§unsafe fn forward_unchecked(start: Self, count: usize) -> Self
unsafe fn forward_unchecked(start: Self, count: usize) -> Self
step_trait)§fn backward(start: Self, count: usize) -> Self
fn backward(start: Self, count: usize) -> Self
step_trait)§unsafe fn backward_unchecked(start: Self, count: usize) -> Self
unsafe fn backward_unchecked(start: Self, count: usize) -> Self
step_trait)impl<S: PartialEq + PageSize> StructuralPartialEq for Page<S>
Auto Trait Implementations§
impl<S> Freeze for Page<S>
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> UnsafeUnpin for Page<S>
impl<S> UnwindSafe for Page<S>where
S: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)