Skip to main content

MachineRegister

Struct MachineRegister 

Source
pub struct MachineRegister { /* private fields */ }
Expand description

MachineRegister is a datatype that can hold exactly the contents of a register with no additional semantic information.

MachineRegister is useful when you know data is the size of a register, but not its true data type. In the future it may be possible, useful, or necessary to change the implementation of MachineRegister, however, the semantics will remain. No use of MachineRegister should assume a particular Rust implementation or any semantics other this description.

Implementations§

Source§

impl MachineRegister

Source

pub fn as_capability_ptr(self) -> CapabilityPtr

Returns this MachineRegister as a CapabilityPtr.

If this MachineRegister contains a pointer with provenance and/or authority, the returned CapabilityPtr will have the same provenance and/or authority.

Source

pub fn as_usize(self) -> usize

Returns this MachineRegister as a usize.

This is intended for use on MachineRegisters created from a usize, in which case the original usize will be returned. If this MachineRegister was created from a pointer, this returns the pointer’s address (without exposing provenance).

Source

pub fn as_usize_32bit(self) -> usize

Returns this MachineRegister as a usize, 32 bits only.

This returns a usize, but only uses the lowest 32 bits from the MachineRegister. If there are upper bits, they are set to 0. This is useful for capturing only the lower 32 bits on a 64-bit machine.

This is intended for use on MachineRegisters created from a usize, in which case 32 bits of the original usize will be returned. If this MachineRegister was created from a pointer, this returns the lowest 32 bits of the pointer’s address (without exposing provenance).

Trait Implementations§

Source§

impl Clone for MachineRegister

Source§

fn clone(&self) -> MachineRegister

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for MachineRegister

Source§

impl Debug for MachineRegister

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for MachineRegister

Source§

fn default() -> MachineRegister

Returns the “default value” for a type. Read more
Source§

impl Eq for MachineRegister

Source§

impl From<CapabilityPtr> for MachineRegister

Source§

fn from(from: CapabilityPtr) -> Self

Creates a MachineRegister containing this CapabilityPtr, including its provenance.

Source§

impl From<usize> for MachineRegister

Source§

fn from(from: usize) -> Self

Converts to this type from the input type.
Source§

impl Hash for MachineRegister

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 LowerHex for MachineRegister

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Ord for MachineRegister

Source§

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

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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 MachineRegister

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for MachineRegister

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 StructuralPartialEq for MachineRegister

Source§

impl UpperHex for MachineRegister

Source§

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

Formats the value using the given formatter. Read more

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, 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.