Struct ByteAddr

Source
#[repr(C)]
pub struct ByteAddr(/* private fields */);
Expand description

A ByteAddr is a value representing the address of zero or more bytes of memory.

Trait Implementations§

Source§

impl Address for ByteAddr

Source§

fn from_usize(val: usize) -> ByteAddr

Constructor for a byte address from a raw usize.

let ba = ByteAddr::from_usize(0xdeadbeef);
Source§

fn as_usize(&self) -> usize

Deconstructor for a byte address into a raw usize value.

let ba = ByteAddr::from_usize(0xdeadbeef);
assert!(ba.as_usize() == 3735928559);
Source§

fn verify(self) -> bool

All byte addresses are valid:

let ba = ByteAddr::from_usize(0xdeadbeef);
assert!(ba.verify());
Source§

fn load<T: Copy>(&self) -> T

A generic address to a raw byte cannot be accessed.

Source§

fn store<T>(&self, value: T)

A generic address to a raw byte cannot be accessed.

Source§

fn plus<A: Address>(&self, bytes: usize) -> A

Add some number of bytes to this address, producing an address of type A. Read more
Source§

fn sub<A: Address>(&self, bytes: usize) -> A

Subtract some number of bytes from this address, producing an address of type A. Read more
Source§

fn offset<T, A: Address>(&self, offset: usize) -> A

Offset this &self address some number of instances of type T, producing an address of type A. Read more
Source§

fn is_zero(&self) -> bool

Is the value of this address equivalent to the (universal) null value? Read more
Source§

fn align_up<A: Address>(&self, align: usize) -> A

Align this pointer up (increasing value) to the nearest address with a value aligned to align bytes. For example the following properties hold: Read more
Source§

fn gte<A: Address>(&self, addr: A) -> bool

Is the value of this address greater than or equal to the value of the given address? Read more
Source§

fn greater<A: Address>(&self, addr: A) -> bool

Is the value of this address greater than the value of the given address? Read more
Source§

fn lte<A: Address>(&self, addr: A) -> bool

Is the value of this address less than or equal to the value of the given address? Read more
Source§

fn less<A: Address>(&self, addr: A) -> bool

Is the value of this address less than the value of the given address? Read more
Source§

fn is_aligned_to(&self, align: usize) -> bool

Is the value of this address exactly aligned to the given alignment? Read more
Source§

fn from_ptr<T>(ptr: *const T) -> Self

Construct an address from an immutable constant Rust pointer type. Read more
Source§

fn to_ptr<T>(&self) -> *const T

Deconstruct an address into an immutable constant Rust pointer type. Read more
Source§

fn to_ptr_mut<T>(&self) -> *mut T

Construct an address from a mutable constant Rust pointer type. Read more
Source§

fn zero() -> Self

Construct the (universal) null address. Read more
Source§

fn diff<A: Address>(&self, another: A) -> usize

Compute the number of bytes before this address (exclusive) and after another address (inclusive). Read more
Source§

fn memset(&self, val: u8, length: usize)

Set the first length bytes pointed to by this address to the byte val. Read more
Source§

impl Clone for ByteAddr

Source§

fn clone(&self) -> ByteAddr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ByteAddr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Display this address as a prettified alphanumeric hex string for debugging.

Source§

impl Display for ByteAddr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Display this address as a prettified alphanumeric hex string.

Source§

impl Hash for ByteAddr

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for ByteAddr

Source§

fn cmp(&self, other: &ByteAddr) -> Ordering

Address ordinality delegates to usize ordinality.

1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for ByteAddr

Source§

fn eq(&self, other: &ByteAddr) -> bool

Address equality delegates to usize equality

Source§

fn ne(&self, other: &ByteAddr) -> bool

Address inequality delegates to usize equality

Source§

impl PartialOrd for ByteAddr

Source§

fn partial_cmp(&self, other: &ByteAddr) -> Option<Ordering>

Address ordinality delegates to usize ordinality.

1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Pointer for ByteAddr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Display this address as a prettified alphanumeric hex string.

Source§

impl UpperHex for ByteAddr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Format this address as an alphanumeric hex string.

Source§

impl Copy for ByteAddr

Source§

impl Eq for ByteAddr

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.