[−][src]Struct x86_64::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]
pub fn new(addr: u64) -> PhysAddr
[src]
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]
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]
Converts the address to an u64
.
pub 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]
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]
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]
U: Into<u64>,
Checks whether the physical address has the demanded alignment.
Trait Implementations
impl PartialEq<PhysAddr> for PhysAddr
[src]
impl Eq for PhysAddr
[src]
impl Ord for PhysAddr
[src]
fn cmp(&self, other: &PhysAddr) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Restrict a value to a certain interval. Read more
impl PartialOrd<PhysAddr> for PhysAddr
[src]
fn partial_cmp(&self, other: &PhysAddr) -> Option<Ordering>
[src]
fn lt(&self, other: &PhysAddr) -> bool
[src]
fn le(&self, other: &PhysAddr) -> bool
[src]
fn gt(&self, other: &PhysAddr) -> bool
[src]
fn ge(&self, other: &PhysAddr) -> bool
[src]
impl Copy for PhysAddr
[src]
impl Debug for PhysAddr
[src]
impl Add<u64> for PhysAddr
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: u64) -> Self::Output
[src]
impl Sub<u64> for PhysAddr
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: u64) -> Self::Output
[src]
impl Sub<PhysAddr> for PhysAddr
[src]
type Output = u64
The resulting type after applying the -
operator.
fn sub(self, rhs: PhysAddr) -> Self::Output
[src]
impl AddAssign<u64> for PhysAddr
[src]
fn add_assign(&mut self, rhs: u64)
[src]
impl SubAssign<u64> for PhysAddr
[src]
fn sub_assign(&mut self, rhs: u64)
[src]
impl Octal for PhysAddr
[src]
impl Binary for PhysAddr
[src]
impl LowerHex for PhysAddr
[src]
impl UpperHex for PhysAddr
[src]
impl Clone for PhysAddr
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
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>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
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>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,