Struct VAddr

Source
#[repr(transparent)]
pub struct VAddr(pub u64);
Expand description

A wrapper for a virtual address.

Tuple Fields§

§0: u64

Implementations§

Source§

impl VAddr

Source

pub const fn from_u64(v: u64) -> Self

Convert from u64

Source

pub const fn from_usize(v: usize) -> Self

Convert from usize

Source

pub const fn as_u64(self) -> u64

Convert to u64

Source

pub const fn as_usize(self) -> usize

Convert to usize

Source

pub fn as_mut_ptr<T>(self) -> *mut T

Convert to mutable pointer.

Source

pub fn as_ptr<T>(self) -> *const T

Convert to pointer.

Source

pub const fn zero() -> Self

Virtual Address zero.

Source

pub fn is_zero(self) -> bool

Is zero?

Source

pub fn base_page_offset(self) -> u64

Offset within the 4 KiB page.

Source

pub fn large_page_offset(self) -> u64

Offset within the 2 MiB page.

Source

pub fn huge_page_offset(self) -> u64

Offset within the 1 GiB page.

Source

pub fn align_down_to_base_page(self) -> Self

Return address of nearest 4 KiB page (lower or equal than self).

Source

pub fn align_down_to_large_page(self) -> Self

Return address of nearest 2 MiB page (lower or equal than self).

Source

pub fn align_down_to_huge_page(self) -> Self

Return address of nearest 1 GiB page (lower or equal than self).

Source

pub fn align_up_to_base_page(self) -> Self

Return address of nearest 4 KiB page (higher or equal than self).

Source

pub fn align_up_to_large_page(self) -> Self

Return address of nearest 2 MiB page (higher or equal than self).

Source

pub fn align_up_to_huge_page(self) -> Self

Return address of nearest 1 GiB page (higher or equal than self).

Source

pub fn is_base_page_aligned(self) -> bool

Is this address aligned to a 4 KiB page?

Source

pub fn is_large_page_aligned(self) -> bool

Is this address aligned to a 2 MiB page?

Source

pub fn is_huge_page_aligned(self) -> bool

Is this address aligned to a 1 GiB page?

Source

pub fn is_aligned<U>(self, align: U) -> bool
where U: Into<u64> + Copy,

Is this address aligned to align?

§Note

align must be a power of two.

Trait Implementations§

Source§

impl Add<u64> for VAddr

Source§

type Output = VAddr

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<usize> for VAddr

Source§

type Output = VAddr

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for VAddr

Source§

type Output = VAddr

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl AddAssign<u64> for VAddr

Source§

fn add_assign(&mut self, offset: u64)

Performs the += operation. Read more
Source§

impl AddAssign<usize> for VAddr

Source§

fn add_assign(&mut self, offset: usize)

Performs the += operation. Read more
Source§

impl AddAssign for VAddr

Source§

fn add_assign(&mut self, other: VAddr)

Performs the += operation. Read more
Source§

impl Binary for VAddr

Source§

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

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

impl BitAnd<i32> for VAddr

Source§

type Output = VAddr

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: i32) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd<u64> for VAddr

Source§

type Output = VAddr

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: u64) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAnd<usize> for VAddr

Source§

type Output = VAddr

The resulting type after applying the & operator.
Source§

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

Performs the & operation. Read more
Source§

impl BitAnd for VAddr

Source§

type Output = VAddr

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr<u64> for VAddr

Source§

type Output = VAddr

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: u64) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOr<usize> for VAddr

Source§

type Output = VAddr

The resulting type after applying the | operator.
Source§

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

Performs the | operation. Read more
Source§

impl BitOr for VAddr

Source§

type Output = VAddr

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: VAddr) -> VAddr

Performs the | operation. Read more
Source§

impl Clone for VAddr

Source§

fn clone(&self) -> VAddr

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VAddr

Source§

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

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

impl Display for VAddr

Source§

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

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

impl From<i32> for VAddr

Source§

fn from(num: i32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for VAddr

Source§

fn from(num: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for VAddr

Source§

fn from(num: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for VAddr

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Into<u64> for VAddr

Source§

fn into(self) -> u64

Converts this type into the (usually inferred) input type.
Source§

impl Into<usize> for VAddr

Source§

fn into(self) -> usize

Converts this type into the (usually inferred) input type.
Source§

impl LowerHex for VAddr

Source§

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

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

impl Octal for VAddr

Source§

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

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

impl Ord for VAddr

Source§

fn cmp(&self, other: &VAddr) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

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

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

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

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

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

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

impl PartialEq for VAddr

Source§

fn eq(&self, other: &VAddr) -> bool

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

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

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

impl PartialOrd for VAddr

Source§

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

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

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

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

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

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

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

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

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

impl Pointer for VAddr

Source§

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

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

impl Rem<u64> for VAddr

Source§

type Output = u64

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self::Output) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem<usize> for VAddr

Source§

type Output = usize

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self::Output) -> Self::Output

Performs the % operation. Read more
Source§

impl Rem for VAddr

Source§

type Output = VAddr

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: VAddr) -> Self::Output

Performs the % operation. Read more
Source§

impl Shr<i32> for VAddr

Source§

type Output = u64

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: i32) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<u64> for VAddr

Source§

type Output = u64

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: u64) -> Self::Output

Performs the >> operation. Read more
Source§

impl Shr<usize> for VAddr

Source§

type Output = u64

The resulting type after applying the >> operator.
Source§

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

Performs the >> operation. Read more
Source§

impl Sub<u64> for VAddr

Source§

type Output = VAddr

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<usize> for VAddr

Source§

type Output = VAddr

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for VAddr

Source§

type Output = VAddr

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl UpperHex for VAddr

Source§

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

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

impl Copy for VAddr

Source§

impl Eq for VAddr

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.