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 this architecture, there are no extra requirements, and so we just return the address as is.
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 PartialOrd for VAddr
impl PartialOrd for VAddr
Source§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 StructuralPartialEq for VAddr
Auto Trait Implementations§
impl Freeze for VAddr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)