pub struct AddressDiff<T: AddressBase> { /* private fields */ }
Expand description
a struct describing the differece between some pair of A: Address
. this is primarily useful
in describing the size of an instruction, or the relative offset of a branch.
for any address type A
, the following must hold:
use yaxpeax_arch::AddressBase;
fn diff_check<A: AddressBase + core::fmt::Debug>(left: A, right: A) {
let diff = left.diff(&right);
if let Some(offset) = diff {
assert_eq!(left.wrapping_offset(offset), right);
}
}
which is to say, yaxpeax
assumes associativity holds when diff
yields a Some
.
Implementations§
Source§impl<T: Address> AddressDiff<T>
impl<T: Address> AddressDiff<T>
Trait Implementations§
Source§impl AddAssign<AddressDiff<u16>> for u16
impl AddAssign<AddressDiff<u16>> for u16
Source§fn add_assign(&mut self, other: AddressDiff<Self>)
fn add_assign(&mut self, other: AddressDiff<Self>)
Performs the
+=
operation. Read moreSource§impl AddAssign<AddressDiff<u32>> for u32
impl AddAssign<AddressDiff<u32>> for u32
Source§fn add_assign(&mut self, other: AddressDiff<Self>)
fn add_assign(&mut self, other: AddressDiff<Self>)
Performs the
+=
operation. Read moreSource§impl AddAssign<AddressDiff<u64>> for u64
impl AddAssign<AddressDiff<u64>> for u64
Source§fn add_assign(&mut self, other: AddressDiff<Self>)
fn add_assign(&mut self, other: AddressDiff<Self>)
Performs the
+=
operation. Read moreSource§impl AddAssign<AddressDiff<usize>> for usize
impl AddAssign<AddressDiff<usize>> for usize
Source§fn add_assign(&mut self, other: AddressDiff<Self>)
fn add_assign(&mut self, other: AddressDiff<Self>)
Performs the
+=
operation. Read moreSource§impl<T: Clone + AddressBase> Clone for AddressDiff<T>
impl<T: Clone + AddressBase> Clone for AddressDiff<T>
Source§fn clone(&self) -> AddressDiff<T>
fn clone(&self) -> AddressDiff<T>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Address> Debug for AddressDiff<T>
impl<T: Address> Debug for AddressDiff<T>
Source§impl<T: Ord + AddressBase> Ord for AddressDiff<T>
impl<T: Ord + AddressBase> Ord for AddressDiff<T>
Source§fn cmp(&self, other: &AddressDiff<T>) -> Ordering
fn cmp(&self, other: &AddressDiff<T>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialEq + AddressBase> PartialEq for AddressDiff<T>
impl<T: PartialEq + AddressBase> PartialEq for AddressDiff<T>
Source§impl<T: PartialOrd + AddressBase> PartialOrd for AddressDiff<T>where
T::Diff: PartialOrd,
impl<T: PartialOrd + AddressBase> PartialOrd for AddressDiff<T>where
T::Diff: PartialOrd,
Source§impl SubAssign<AddressDiff<u16>> for u16
impl SubAssign<AddressDiff<u16>> for u16
Source§fn sub_assign(&mut self, other: AddressDiff<Self>)
fn sub_assign(&mut self, other: AddressDiff<Self>)
Performs the
-=
operation. Read moreSource§impl SubAssign<AddressDiff<u32>> for u32
impl SubAssign<AddressDiff<u32>> for u32
Source§fn sub_assign(&mut self, other: AddressDiff<Self>)
fn sub_assign(&mut self, other: AddressDiff<Self>)
Performs the
-=
operation. Read moreSource§impl SubAssign<AddressDiff<u64>> for u64
impl SubAssign<AddressDiff<u64>> for u64
Source§fn sub_assign(&mut self, other: AddressDiff<Self>)
fn sub_assign(&mut self, other: AddressDiff<Self>)
Performs the
-=
operation. Read moreSource§impl SubAssign<AddressDiff<usize>> for usize
impl SubAssign<AddressDiff<usize>> for usize
Source§fn sub_assign(&mut self, other: AddressDiff<Self>)
fn sub_assign(&mut self, other: AddressDiff<Self>)
Performs the
-=
operation. Read moreimpl<T: Copy + AddressBase> Copy for AddressDiff<T>
impl<T: Eq + AddressBase> Eq for AddressDiff<T>
impl<T: AddressBase> StructuralPartialEq for AddressDiff<T>
Auto Trait Implementations§
impl<T> Freeze for AddressDiff<T>
impl<T> RefUnwindSafe for AddressDiff<T>
impl<T> Send for AddressDiff<T>
impl<T> Sync for AddressDiff<T>
impl<T> Unpin for AddressDiff<T>
impl<T> UnwindSafe for AddressDiff<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more