#[repr(transparent)]pub struct VirtualAddress<const ALIGN: usize = 1> {
pub addr: usize,
}
Expand description
A virtual memory address of alignment ALIGN
Fields§
§addr: usize
🔬This is a nightly-only experimental API. (
kernel_memory_addr_access
)Implementations§
Source§impl<const ALIGN: usize> VirtualAddress<ALIGN>
impl<const ALIGN: usize> VirtualAddress<ALIGN>
1.0.0 (const: 1.0.0) · Sourcepub const fn new(addr: usize) -> Self
pub const fn new(addr: usize) -> Self
Creates a new VirtualAddress
, panicking if the alignment is incorrect
1.0.0 (const: 1.0.0) · Sourcepub const fn as_ptr(self) -> *mut u8
pub const fn as_ptr(self) -> *mut u8
Converts a VirtualAddress
into a raw pointer
1.0.0 (const: 1.0.0) · Sourcepub const unsafe fn align_unchecked<const NEW_ALIGN: usize>(
self,
) -> VirtualAddress<NEW_ALIGN>
pub const unsafe fn align_unchecked<const NEW_ALIGN: usize>( self, ) -> VirtualAddress<NEW_ALIGN>
Forces a VirtualAddress
to have a specific alignment
§Safety
The address must be already aligned to the new alignment
1.0.0 (const: 1.0.0) · Sourcepub const fn align_down<const NEW_ALIGN: usize>(
self,
) -> VirtualAddress<NEW_ALIGN>
pub const fn align_down<const NEW_ALIGN: usize>( self, ) -> VirtualAddress<NEW_ALIGN>
Returns the VirtualAddress
less than or equal to self
with the given alignment
1.0.0 (const: 1.0.0) · Sourcepub const fn align_up<const NEW_ALIGN: usize>(self) -> VirtualAddress<NEW_ALIGN>
pub const fn align_up<const NEW_ALIGN: usize>(self) -> VirtualAddress<NEW_ALIGN>
Returns the VirtualAddress
greater than or equal to self
with the given alignment
Sourcepub const fn align_down_runtime(self, new_alignment: usize) -> VirtualAddress<1>
🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime
)
pub const fn align_down_runtime(self, new_alignment: usize) -> VirtualAddress<1>
kernel_address_alignment_runtime
)Returns the VirtualAddress
less than or equal to self
with the given runtime alignment
Sourcepub const fn align_up_runtime(self, new_alignment: usize) -> VirtualAddress<1>
🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime
)
pub const fn align_up_runtime(self, new_alignment: usize) -> VirtualAddress<1>
kernel_address_alignment_runtime
)Returns the VirtualAddress
greater than or equal to self
with the given runtime alignment
pub const fn aligned<const N: usize>(self) -> VirtualAddress<N>
🔬This is a nightly-only experimental API. (
kernel_address_alignment_runtime
)Trait Implementations§
1.0.0 · Source§impl<const ALIGN: usize> Add<isize> for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Add<isize> for VirtualAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Add<usize> for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Add<usize> for VirtualAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Clone for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Clone for VirtualAddress<ALIGN>
Source§fn clone(&self) -> VirtualAddress<ALIGN>
fn clone(&self) -> VirtualAddress<ALIGN>
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more1.0.0 · Source§impl<const ALIGN: usize> Debug for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Debug for VirtualAddress<ALIGN>
1.0.0 · Source§impl<T: ?Sized> From<*const T> for VirtualAddress<1>
impl<T: ?Sized> From<*const T> for VirtualAddress<1>
1.0.0 · Source§impl<T: ?Sized> From<*mut T> for VirtualAddress<1>
impl<T: ?Sized> From<*mut T> for VirtualAddress<1>
1.0.0 · Source§impl<const ALIGN: usize> Ord for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Ord for VirtualAddress<ALIGN>
1.0.0 · Source§impl<const A: usize, const B: usize> PartialEq<VirtualAddress<A>> for VirtualAddress<B>
impl<const A: usize, const B: usize> PartialEq<VirtualAddress<A>> for VirtualAddress<B>
1.0.0 · Source§impl<const A: usize, const B: usize> PartialOrd<VirtualAddress<A>> for VirtualAddress<B>
impl<const A: usize, const B: usize> PartialOrd<VirtualAddress<A>> for VirtualAddress<B>
Source§fn partial_cmp(&self, other: &VirtualAddress<A>) -> Option<Ordering>
fn partial_cmp(&self, other: &VirtualAddress<A>) -> Option<Ordering>
1.0.0 · Source§impl<const A: usize, const B: usize> Sub<VirtualAddress<A>> for VirtualAddress<B>
impl<const A: usize, const B: usize> Sub<VirtualAddress<A>> for VirtualAddress<B>
1.0.0 · Source§impl<const ALIGN: usize> Sub<isize> for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Sub<isize> for VirtualAddress<ALIGN>
1.0.0 · Source§impl<const ALIGN: usize> Sub<usize> for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Sub<usize> for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Copy for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Eq for VirtualAddress<ALIGN>
Auto Trait Implementations§
impl<const ALIGN: usize> Freeze for VirtualAddress<ALIGN>
impl<const ALIGN: usize> RefUnwindSafe for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Send for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Sync for VirtualAddress<ALIGN>
impl<const ALIGN: usize> Unpin for VirtualAddress<ALIGN>
impl<const ALIGN: usize> UnwindSafe for VirtualAddress<ALIGN>
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
Mutably borrows from an owned value. Read more
§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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
#126799)