Struct VirtualAddress

1.0.0 · Source
#[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>

1.0.0 (const: 1.0.0) · Source

pub const fn new(addr: usize) -> Self

Creates a new VirtualAddress, panicking if the alignment is incorrect

1.0.0 (const: 1.0.0) · Source

pub const fn as_ptr(self) -> *mut u8

Converts a VirtualAddress into a raw pointer

1.0.0 (const: 1.0.0) · Source

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) · Source

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) · Source

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

Source

pub const fn align_down_runtime(self, new_alignment: usize) -> VirtualAddress<1>

🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime)

Returns the VirtualAddress less than or equal to self with the given runtime alignment

Source

pub const fn align_up_runtime(self, new_alignment: usize) -> VirtualAddress<1>

🔬This is a nightly-only experimental API. (kernel_address_alignment_runtime)

Returns the VirtualAddress greater than or equal to self with the given runtime alignment

Source

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>

Source§

type Output = VirtualAddress

The resulting type after applying the + operator.
Source§

fn add(self, rhs: isize) -> Self::Output

Performs the + operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Add<usize> for VirtualAddress<ALIGN>

Source§

type Output = VirtualAddress

The resulting type after applying the + operator.
Source§

fn add(self, rhs: usize) -> Self::Output

Performs the + operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Clone for VirtualAddress<ALIGN>

Source§

fn clone(&self) -> VirtualAddress<ALIGN>

Returns a copy of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Debug for VirtualAddress<ALIGN>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
1.0.0 · Source§

impl<T: ?Sized> From<*const T> for VirtualAddress<1>

Source§

fn from(value: *const T) -> Self

Converts to this type from the input type.
1.0.0 · Source§

impl<T: ?Sized> From<*mut T> for VirtualAddress<1>

Source§

fn from(value: *mut T) -> Self

Converts to this type from the input type.
1.0.0 · Source§

impl<const ALIGN: usize> Ord for VirtualAddress<ALIGN>

Source§

fn cmp(&self, other: &VirtualAddress<ALIGN>) -> Ordering

This method returns an [Ordering] between self and other. Read more
1.21.0§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
1.0.0 · Source§

impl<const A: usize, const B: usize> PartialEq<VirtualAddress<A>> for VirtualAddress<B>

Source§

fn eq(&self, other: &VirtualAddress<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
1.0.0 · Source§

impl<const A: usize, const B: usize> PartialOrd<VirtualAddress<A>> for VirtualAddress<B>

Source§

fn partial_cmp(&self, other: &VirtualAddress<A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
1.0.0 · Source§

impl<const A: usize, const B: usize> Sub<VirtualAddress<A>> for VirtualAddress<B>

Source§

type Output = usize

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: VirtualAddress<A>) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Sub<isize> for VirtualAddress<ALIGN>

Source§

type Output = VirtualAddress

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: isize) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Sub<usize> for VirtualAddress<ALIGN>

Source§

type Output = VirtualAddress

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: usize) -> Self::Output

Performs the - operation. Read more
1.0.0 · Source§

impl<const ALIGN: usize> Copy for VirtualAddress<ALIGN>

1.0.0 · Source§

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 T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit #126799)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.