Struct memory_addr::VirtAddr
source · pub struct VirtAddr(/* private fields */);
Expand description
A virtual memory address.
It’s a wrapper type around an usize
.
Implementations§
source§impl VirtAddr
impl VirtAddr
sourcepub const fn as_mut_ptr(self) -> *mut u8
pub const fn as_mut_ptr(self) -> *mut u8
Converts the virtual address to a mutable raw pointer.
sourcepub fn align_down<U>(self, align: U) -> Self
pub fn align_down<U>(self, align: U) -> Self
Aligns the address downwards to the given alignment.
See the align_down
function for more information.
sourcepub fn align_up<U>(self, align: U) -> Self
pub fn align_up<U>(self, align: U) -> Self
Aligns the address upwards to the given alignment.
See the align_up
function for more information.
sourcepub fn align_offset<U>(self, align: U) -> usize
pub fn align_offset<U>(self, align: U) -> usize
Returns the offset of the address within the given alignment.
See the align_offset
function for more information.
sourcepub fn is_aligned<U>(self, align: U) -> bool
pub fn is_aligned<U>(self, align: U) -> bool
Checks whether the address has the demanded alignment.
See the is_aligned
function for more information.
sourcepub fn align_down_4k(self) -> Self
pub fn align_down_4k(self) -> Self
Aligns the address downwards to 4096 (bytes).
sourcepub fn align_up_4k(self) -> Self
pub fn align_up_4k(self) -> Self
Aligns the address upwards to 4096 (bytes).
sourcepub fn align_offset_4k(self) -> usize
pub fn align_offset_4k(self) -> usize
Returns the offset of the address within a 4K-sized page.
sourcepub fn is_aligned_4k(self) -> bool
pub fn is_aligned_4k(self) -> bool
Checks whether the address is 4K-aligned.
Trait Implementations§
source§impl AddAssign<usize> for VirtAddr
impl AddAssign<usize> for VirtAddr
source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
Performs the
+=
operation. Read moresource§impl Ord for VirtAddr
impl Ord for VirtAddr
source§impl PartialEq for VirtAddr
impl PartialEq for VirtAddr
source§impl PartialOrd for VirtAddr
impl PartialOrd for VirtAddr
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 VirtAddr
impl SubAssign<usize> for VirtAddr
source§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
Performs the
-=
operation. Read moreimpl Copy for VirtAddr
impl Eq for VirtAddr
impl StructuralEq for VirtAddr
impl StructuralPartialEq for VirtAddr
Auto Trait Implementations§
impl RefUnwindSafe for VirtAddr
impl Send for VirtAddr
impl Sync for VirtAddr
impl Unpin for VirtAddr
impl UnwindSafe for VirtAddr
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