Struct x86_64::addr::PhysAddr[][src]

#[repr(transparent)]
pub struct PhysAddr(_);

A 64-bit physical memory address.

This is a wrapper type around an u64, so it is always 8 bytes, even when compiled on non 64-bit systems. The TryFrom trait can be used for performing conversions between u64 and usize.

On x86_64, only the 52 lower bits of a physical address can be used. The top 12 bits need to be zero. This type guarantees that it always represents a valid physical address.

Implementations

impl PhysAddr[src]

pub fn new(addr: u64) -> PhysAddr[src]

Creates a new physical address.

Panics

This function panics if a bit in the range 52 to 64 is set.

pub const fn new_truncate(addr: u64) -> PhysAddr[src]

Creates a new physical address, throwing bits 52..64 away.

pub const unsafe fn new_unsafe(addr: u64) -> PhysAddr[src]

Creates a new physical address, without any checks.

Safety

You must make sure bits 52..64 are zero. This is not checked.

pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid>[src]

Tries to create a new physical address.

Fails if any bits in the range 52 to 64 are set.

pub const fn zero() -> PhysAddr[src]

Creates a physical address that points to 0.

pub const fn as_u64(self) -> u64[src]

Converts the address to an u64.

pub const fn is_null(self) -> bool[src]

Convenience method for checking if a physical address is null.

pub fn align_up<U>(self, align: U) -> Self where
    U: Into<u64>, 
[src]

Aligns the physical address upwards to the given alignment.

See the align_up function for more information.

pub fn align_down<U>(self, align: U) -> Self where
    U: Into<u64>, 
[src]

Aligns the physical address downwards to the given alignment.

See the align_down function for more information.

pub fn is_aligned<U>(self, align: U) -> bool where
    U: Into<u64>, 
[src]

Checks whether the physical address has the demanded alignment.

Trait Implementations

impl Add<u64> for PhysAddr[src]

type Output = Self

The resulting type after applying the + operator.

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

Performs the + operation. Read more

impl Add<usize> for PhysAddr[src]

type Output = Self

The resulting type after applying the + operator.

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

Performs the + operation. Read more

impl AddAssign<u64> for PhysAddr[src]

fn add_assign(&mut self, rhs: u64)[src]

Performs the += operation. Read more

impl AddAssign<usize> for PhysAddr[src]

fn add_assign(&mut self, rhs: usize)[src]

Performs the += operation. Read more

impl Binary for PhysAddr[src]

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

Formats the value using the given formatter.

impl Clone for PhysAddr[src]

fn clone(&self) -> PhysAddr[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PhysAddr[src]

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

Formats the value using the given formatter. Read more

impl LowerHex for PhysAddr[src]

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

Formats the value using the given formatter.

impl Octal for PhysAddr[src]

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

Formats the value using the given formatter.

impl Ord for PhysAddr[src]

fn cmp(&self, other: &PhysAddr) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<PhysAddr> for PhysAddr[src]

fn eq(&self, other: &PhysAddr) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &PhysAddr) -> bool[src]

This method tests for !=.

impl PartialOrd<PhysAddr> for PhysAddr[src]

fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>[src]

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Pointer for PhysAddr[src]

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

Formats the value using the given formatter.

impl Sub<PhysAddr> for PhysAddr[src]

type Output = u64

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl Sub<u64> for PhysAddr[src]

type Output = Self

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl Sub<usize> for PhysAddr[src]

type Output = Self

The resulting type after applying the - operator.

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

Performs the - operation. Read more

impl SubAssign<u64> for PhysAddr[src]

fn sub_assign(&mut self, rhs: u64)[src]

Performs the -= operation. Read more

impl SubAssign<usize> for PhysAddr[src]

fn sub_assign(&mut self, rhs: usize)[src]

Performs the -= operation. Read more

impl UpperHex for PhysAddr[src]

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

Formats the value using the given formatter.

impl Copy for PhysAddr[src]

impl Eq for PhysAddr[src]

impl StructuralEq for PhysAddr[src]

impl StructuralPartialEq for PhysAddr[src]

Auto Trait Implementations

impl Send for PhysAddr

impl Sync for PhysAddr

impl Unpin for PhysAddr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.