Skip to main content

PhysAddr

Struct PhysAddr 

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

A type representing physical addresses in the CPU’s physical address space

Tuple Fields§

§0: u64

Implementations§

Source§

impl PhysAddr

Source

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

Creates a new PhysAddr from a raw u64 address

Source

pub const fn null() -> Self

Creates a new PhysAddr which points to 0

Source

pub fn as_u64(self) -> u64

Returns the address as a u64

Source

pub fn as_usize(self) -> usize

Returns the address as a usize

Source

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

Returns the address as a *const T pointer

Source

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

Returns the address as a *mut T pointer

Source

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

Returns the address as a *const T pointer with the HHDM offset added

Source

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

Returns the address as a *mut T pointer with the HHDM offset added

Source

pub fn align_up(self, align: u64) -> Self

Returns a new address aligned to the next larger address which is aligned to align

§Panics

In debug builds if align is not a power of two

Source

pub fn align_down(self, align: u64) -> Self

Returns a new address aligned to the next smaller address which is aligned to align

§Panics

In debug builds if align is not a power of two

Source

pub fn is_aligned(self, align: u64) -> bool

Check whether the address is aligned to align

Source§

impl PhysAddr

Source

pub fn as_x86_64(self) -> PhysAddr

Returns a [x86_64::PhysAddr] with the same address value

Trait Implementations§

Source§

impl Add for PhysAddr

Source§

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

Add trait for adding a PhysAddr to a PhysAddr, returns a new instance of PhysAddr

Source§

type Output = PhysAddr

The resulting type after applying the + operator.
Source§

impl Add<u64> for PhysAddr

Source§

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

Add trait for adding a u64 to a PhysAddr, returns a new instance of PhysAddr

Source§

type Output = PhysAddr

The resulting type after applying the + operator.
Source§

impl AddAssign for PhysAddr

Source§

fn add_assign(&mut self, rhs: PhysAddr)

AddAssign trait for add-assigning a PhysAddr to a PhysAddr

Source§

impl AddAssign<u64> for PhysAddr

Source§

fn add_assign(&mut self, rhs: u64)

AddAssign trait for add-assigning a u64 to a PhysAddr

Source§

impl Clone for PhysAddr

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable)§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for PhysAddr

Source§

impl Debug for PhysAddr

Source§

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

Formats the address as PhysAddr(0x<hex>) (e.g. PhysAddr(0x1000))

Source§

impl Display for PhysAddr

Source§

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

Formats the address as 0x<hex> (e.g. 0x1000)

Source§

impl Eq for PhysAddr

Source§

impl Hash for PhysAddr

Source§

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

Feeds this value into the given [Hasher]. Read more
1.3.0§

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 LowerHex for PhysAddr

Source§

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

Delegates to the inner u64 for {:x} / {:#x} to work

Source§

impl Ord for PhysAddr

Source§

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

This method returns an [Ordering] between self and other. Read more
1.21.0 (const: unstable)§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable)§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable)§

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

Restrict a value to a certain interval. Read more
§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for PhysAddr

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable)§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for PhysAddr

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable)§

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

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

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 (const: unstable)§

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

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

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 StructuralPartialEq for PhysAddr

Source§

impl Sub for PhysAddr

Source§

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

Sub trait for subtracting a PhysAddr from a PhysAddr, returns a new instance of PhysAddr

Source§

type Output = PhysAddr

The resulting type after applying the - operator.
Source§

impl Sub<u64> for PhysAddr

Source§

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

Sub trait for subtracting a u64 from a PhysAddr, returns a new instance of PhysAddr

Source§

type Output = PhysAddr

The resulting type after applying the - operator.
Source§

impl SubAssign for PhysAddr

Source§

fn sub_assign(&mut self, rhs: PhysAddr)

SubAssign trait for sub-assigning a PhysAddr from a PhysAddr

Source§

impl SubAssign<u64> for PhysAddr

Source§

fn sub_assign(&mut self, rhs: u64)

SubAssign trait for sub-assigning a u64 from a PhysAddr

Source§

impl UpperHex for PhysAddr

Source§

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

Delegates to the inner u64 for {:X} / {:#X} to work

Auto Trait Implementations§

§

impl Freeze for PhysAddr

§

impl RefUnwindSafe for PhysAddr

§

impl Send for PhysAddr

§

impl Sync for PhysAddr

§

impl Unpin for PhysAddr

§

impl UnsafeUnpin for PhysAddr

§

impl UnwindSafe for PhysAddr

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)
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> ToString for T
where T: Display + ?Sized,

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.