Skip to main content

MemoryAddress

Trait MemoryAddress 

Source
pub trait MemoryAddress:
    PartialEq
    + Eq
    + PartialOrd
    + Ord
    + Copy
    + Clone
    + Sized
    + BitAnd<Self::RAW, Output = Self::RAW>
    + BitAndAssign<Self::RAW>
    + BitOr<Self::RAW, Output = Self::RAW>
    + BitOrAssign<Self::RAW>
    + BitXor<Self::RAW, Output = Self::RAW>
    + BitXorAssign<Self::RAW>
    + Add<Self::RAW>
    + AddAssign<Self::RAW>
    + Sub<Self, Output = Self::RAW>
    + Sub<Self::RAW, Output = Self>
    + SubAssign<Self::RAW>
    + Shr<usize, Output = Self>
    + ShrAssign<usize>
    + Shl<usize, Output = Self>
    + ShlAssign<usize>
    + Binary
    + LowerHex
    + UpperHex
    + Octal
    + Pointer {
    type RAW: Copy + PartialEq + Eq + PartialOrd + Ord + Not<Output = Self::RAW> + Add<Output = Self::RAW> + Sub<Output = Self::RAW> + BitAnd<Output = Self::RAW> + BitOr<Output = Self::RAW> + BitXor<Output = Self::RAW> + Debug + From<u8> + TryInto<usize, Error: Debug> + TryFrom<usize, Error: Debug>;

    // Required methods
    fn raw(self) -> Self::RAW;
    fn checked_add(self, rhs: Self::RAW) -> Option<Self>;
    fn checked_sub(self, rhs: Self::RAW) -> Option<Self>;
}
Expand description

Trait that marks memory addresses.

An address must be a wrapper around a numeric value and thus behave like a number.

Required Associated Types§

Source

type RAW: Copy + PartialEq + Eq + PartialOrd + Ord + Not<Output = Self::RAW> + Add<Output = Self::RAW> + Sub<Output = Self::RAW> + BitAnd<Output = Self::RAW> + BitOr<Output = Self::RAW> + BitXor<Output = Self::RAW> + Debug + From<u8> + TryInto<usize, Error: Debug> + TryFrom<usize, Error: Debug>

Inner address type

Required Methods§

Source

fn raw(self) -> Self::RAW

Get the raw underlying address value.

Source

fn checked_add(self, rhs: Self::RAW) -> Option<Self>

Performs an add operation with rhs returning None if the operation overflowed or resulted in an invalid address.

Source

fn checked_sub(self, rhs: Self::RAW) -> Option<Self>

Performs a sub operation with rhs returning None if the operation overflowed or resulted in an invalid address.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl MemoryAddress for memory_addresses::arch::fallback::PhysAddr

Source§

impl MemoryAddress for memory_addresses::arch::fallback::VirtAddr

Source§

impl MemoryAddress for memory_addresses::arch::x86_64::PhysAddr

Source§

impl MemoryAddress for memory_addresses::arch::x86_64::VirtAddr