#[repr(transparent)]pub struct VirtualPage<S: PageSize>(MemoryPage<S>);Expand description
Virtual memory page base for size S.
A VirtualPage<S> represents the page-aligned base of a virtual page of
size S (S::SIZE bytes). It is a thin wrapper over MemoryPage<S> with
virtual-address intent.
§Semantics
base()returns the page base as aVirtualAddress.join(off)combines this base with aMemoryAddressOffset<S>to form a fullVirtualAddress.
§Invariants
- The low
S::SHIFTbits of the base are always zero (page aligned).
§Examples
let va = VirtualAddress::new(0xFFFF_FFFF_8000_1234);
let vp = va.page::<Size4K>();
assert_eq!(vp.base().as_u64() & (Size4K::SIZE - 1), 0);
let va2 = vp.join(va.offset::<Size4K>());
assert_eq!(va2.as_u64(), va.as_u64());Tuple Fields§
§0: MemoryPage<S>Implementations§
Source§impl<S: PageSize> VirtualPage<S>
impl<S: PageSize> VirtualPage<S>
pub const fn from_page(p: MemoryPage<S>) -> Self
pub const fn base(self) -> VirtualAddress
pub const fn join(self, off: MemoryAddressOffset<S>) -> VirtualAddress
Trait Implementations§
Source§impl<S: Clone + PageSize> Clone for VirtualPage<S>
impl<S: Clone + PageSize> Clone for VirtualPage<S>
Source§fn clone(&self) -> VirtualPage<S>
fn clone(&self) -> VirtualPage<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: PageSize> Debug for VirtualPage<S>
impl<S: PageSize> Debug for VirtualPage<S>
Source§impl<S> From<MemoryPage<S>> for VirtualPage<S>where
S: PageSize,
impl<S> From<MemoryPage<S>> for VirtualPage<S>where
S: PageSize,
Source§fn from(p: MemoryPage<S>) -> Self
fn from(p: MemoryPage<S>) -> Self
Converts to this type from the input type.
Source§impl<S> From<VirtualPage<S>> for VirtualAddresswhere
S: PageSize,
impl<S> From<VirtualPage<S>> for VirtualAddresswhere
S: PageSize,
Source§fn from(value: VirtualPage<S>) -> Self
fn from(value: VirtualPage<S>) -> Self
Converts to this type from the input type.
Source§impl<S: Ord + PageSize> Ord for VirtualPage<S>
impl<S: Ord + PageSize> Ord for VirtualPage<S>
Source§fn cmp(&self, other: &VirtualPage<S>) -> Ordering
fn cmp(&self, other: &VirtualPage<S>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S: PartialOrd + PageSize> PartialOrd for VirtualPage<S>
impl<S: PartialOrd + PageSize> PartialOrd for VirtualPage<S>
impl<S: Copy + PageSize> Copy for VirtualPage<S>
impl<S: Eq + PageSize> Eq for VirtualPage<S>
impl<S: PageSize> StructuralPartialEq for VirtualPage<S>
Auto Trait Implementations§
impl<S> Freeze for VirtualPage<S>
impl<S> RefUnwindSafe for VirtualPage<S>where
S: RefUnwindSafe,
impl<S> Send for VirtualPage<S>where
S: Send,
impl<S> Sync for VirtualPage<S>where
S: Sync,
impl<S> Unpin for VirtualPage<S>where
S: Unpin,
impl<S> UnwindSafe for VirtualPage<S>where
S: 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