yaxpeax_arch

Trait AddressBase

Source
pub trait AddressBase
where Self: AddressDisplay + Copy + Clone + Sized + Hash + Ord + Eq + PartialEq + Bounded + Add<AddressDiff<Self>, Output = Self> + Sub<AddressDiff<Self>, Output = Self> + AddAssign<AddressDiff<Self>> + SubAssign<AddressDiff<Self>> + Zero,
{ type Diff: AddressDiffAmount; // Required methods fn to_linear(&self) -> usize; fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>; fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self; fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>; }

Required Associated Types§

Required Methods§

Source

fn to_linear(&self) -> usize

Source

fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>

compute the AddressDiff beetween self and other.

may return None if the two addresses aren’t comparable. for example, if a pair of addresses are a data-space address and code-space address, there may be no scalar that can describe the difference between them.

Source

fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self

Source

fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>

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.

Implementations on Foreign Types§

Source§

impl AddressBase for u16

Source§

type Diff = u16

Source§

fn to_linear(&self) -> usize

Source§

fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>

Source§

fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self

Source§

fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>

Source§

impl AddressBase for u32

Source§

type Diff = u32

Source§

fn to_linear(&self) -> usize

Source§

fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>

Source§

fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self

Source§

fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>

Source§

impl AddressBase for u64

Source§

type Diff = u64

Source§

fn to_linear(&self) -> usize

Source§

fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>

Source§

fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self

Source§

fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>

Source§

impl AddressBase for usize

Source§

type Diff = usize

Source§

fn to_linear(&self) -> usize

Source§

fn diff(&self, other: &Self) -> Option<AddressDiff<Self>>

Source§

fn wrapping_offset(&self, other: AddressDiff<Self>) -> Self

Source§

fn checked_offset(&self, other: AddressDiff<Self>) -> Option<Self>

Implementors§