pub struct VAddr(/* private fields */);
Expand description
Represents a virtual address. On architectures that have extra requirements for canonical virtual addresses (e.g. x86_64 requiring correct sign-extension in high bits), these requirements are always enforced.
Implementations§
source§impl VAddr
impl VAddr
sourcepub const fn new(address: usize) -> VAddr
pub const fn new(address: usize) -> VAddr
Construct a new VAddr
. This will canonicalise the given value.
pub const fn ptr<T>(self) -> *const T
pub const fn mut_ptr<T>(self) -> *mut T
sourcepub const fn canonicalise(self) -> VAddr
pub const fn canonicalise(self) -> VAddr
Canonicalise this virtual address. On x86_64 and RV64-Sv48, that involves making sure that bits 48..64 are sign extended from bit 47.
sourcepub fn align_down(self, align: usize) -> VAddr
pub fn align_down(self, align: usize) -> VAddr
Align this address to the given alignment, moving downwards if this is not already aligned. align
must
be 0
or a power-of-two.
sourcepub fn align_up(self, align: usize) -> VAddr
pub fn align_up(self, align: usize) -> VAddr
Align this address to the given alignment, moving upwards if this is not already aligned. align
must be
0
or a power-of-two.
pub fn is_aligned(self, align: usize) -> bool
pub fn checked_add(self, rhs: usize) -> Option<Self>
pub fn checked_sub(self, rhs: usize) -> Option<Self>
Trait Implementations§
source§impl AddAssign<usize> for VAddr
impl AddAssign<usize> for VAddr
source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
Performs the
+=
operation. Read moresource§impl Ord for VAddr
impl Ord for VAddr
source§impl PartialEq for VAddr
impl PartialEq for VAddr
source§impl PartialOrd for VAddr
impl PartialOrd for VAddr
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 SubAssign<usize> for VAddr
impl SubAssign<usize> for VAddr
source§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
Performs the
-=
operation. Read moreimpl Copy for VAddr
impl Eq for VAddr
impl StructuralEq for VAddr
impl StructuralPartialEq for VAddr
Auto Trait Implementations§
impl RefUnwindSafe for VAddr
impl Send for VAddr
impl Sync for VAddr
impl Unpin for VAddr
impl UnwindSafe for VAddr
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