Struct x86_64::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 UsizeConversions
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.
Methods
impl PhysAddr
[src]
impl PhysAddr
pub fn new(addr: u64) -> PhysAddr
[src]
pub fn new(addr: u64) -> PhysAddr
Creates a new physical address.
Panics if a bit in the range 52 to 64 is set.
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid>
[src]
pub fn try_new(addr: u64) -> Result<PhysAddr, PhysAddrNotValid>
Tries to create a new physical address.
Fails if any bits in the range 52 to 64 are set.
pub fn as_u64(self) -> u64
[src]
pub fn as_u64(self) -> u64
Converts the address to an u64
.
pub fn is_null(&self) -> bool
[src]
pub fn is_null(&self) -> bool
Convenience method for checking if a physical address is null.
pub fn align_up<U>(self, align: U) -> Self where
U: Into<u64>,
[src]
pub fn align_up<U>(self, align: U) -> Self where
U: Into<u64>,
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]
pub fn align_down<U>(self, align: U) -> Self where
U: Into<u64>,
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]
pub fn is_aligned<U>(self, align: U) -> bool where
U: Into<u64>,
Checks whether the physical address has the demanded alignment.
Trait Implementations
impl Clone for PhysAddr
[src]
impl Clone for PhysAddr
fn clone(&self) -> PhysAddr
[src]
fn clone(&self) -> PhysAddr
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for PhysAddr
[src]
impl Copy for PhysAddr
impl PartialEq for PhysAddr
[src]
impl PartialEq for PhysAddr
fn eq(&self, other: &PhysAddr) -> bool
[src]
fn eq(&self, other: &PhysAddr) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PhysAddr) -> bool
[src]
fn ne(&self, other: &PhysAddr) -> bool
This method tests for !=
.
impl Eq for PhysAddr
[src]
impl Eq for PhysAddr
impl PartialOrd for PhysAddr
[src]
impl PartialOrd for PhysAddr
fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &PhysAddr) -> bool
[src]
fn lt(&self, other: &PhysAddr) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &PhysAddr) -> bool
[src]
fn le(&self, other: &PhysAddr) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &PhysAddr) -> bool
[src]
fn gt(&self, other: &PhysAddr) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &PhysAddr) -> bool
[src]
fn ge(&self, other: &PhysAddr) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for PhysAddr
[src]
impl Ord for PhysAddr
fn cmp(&self, other: &PhysAddr) -> Ordering
[src]
fn cmp(&self, other: &PhysAddr) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Debug for PhysAddr
[src]
impl Debug for PhysAddr
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Binary for PhysAddr
[src]
impl Binary for PhysAddr
impl LowerHex for PhysAddr
[src]
impl LowerHex for PhysAddr
impl Octal for PhysAddr
[src]
impl Octal for PhysAddr
impl UpperHex for PhysAddr
[src]
impl UpperHex for PhysAddr
impl Add<u64> for PhysAddr
[src]
impl Add<u64> for PhysAddr
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: u64) -> Self::Output
[src]
fn add(self, rhs: u64) -> Self::Output
Performs the +
operation.
impl AddAssign<u64> for PhysAddr
[src]
impl AddAssign<u64> for PhysAddr
fn add_assign(&mut self, rhs: u64)
[src]
fn add_assign(&mut self, rhs: u64)
Performs the +=
operation.
impl Add<usize> for PhysAddr where
u64: FromUsize,
[src]
impl Add<usize> for PhysAddr where
u64: FromUsize,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: usize) -> Self::Output
[src]
fn add(self, rhs: usize) -> Self::Output
Performs the +
operation.
impl AddAssign<usize> for PhysAddr where
u64: FromUsize,
[src]
impl AddAssign<usize> for PhysAddr where
u64: FromUsize,
fn add_assign(&mut self, rhs: usize)
[src]
fn add_assign(&mut self, rhs: usize)
Performs the +=
operation.
impl Sub<u64> for PhysAddr
[src]
impl Sub<u64> for PhysAddr
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: u64) -> Self::Output
[src]
fn sub(self, rhs: u64) -> Self::Output
Performs the -
operation.
impl SubAssign<u64> for PhysAddr
[src]
impl SubAssign<u64> for PhysAddr
fn sub_assign(&mut self, rhs: u64)
[src]
fn sub_assign(&mut self, rhs: u64)
Performs the -=
operation.
impl Sub<usize> for PhysAddr where
u64: FromUsize,
[src]
impl Sub<usize> for PhysAddr where
u64: FromUsize,
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: usize) -> Self::Output
[src]
fn sub(self, rhs: usize) -> Self::Output
Performs the -
operation.
impl SubAssign<usize> for PhysAddr where
u64: FromUsize,
[src]
impl SubAssign<usize> for PhysAddr where
u64: FromUsize,
fn sub_assign(&mut self, rhs: usize)
[src]
fn sub_assign(&mut self, rhs: usize)
Performs the -=
operation.
impl Sub<PhysAddr> for PhysAddr
[src]
impl Sub<PhysAddr> for PhysAddr