DevAddr

Union DevAddr 

Source
#[repr(C)]
pub union DevAddr { pub raw: u32, pub ptr: *mut u8, }
Expand description

Device address representation.

Device address fields in the resource table are commonly filled with pointer values that aren’t known until link time. In Rust, this is only possible using actual pointer types, but the resource table pointer fields are a fixed 32 bits.

In order for this crate to be useful on 64-bit platforms, device addresses are represented using this union. It always contains a raw integer field, and on systems with 32-bit pointers, it also contains a ptr field.

Fields§

§raw: u32

Raw address.

§ptr: *mut u8

Pointer address (only on 32-bit platforms).

Implementations§

Source§

impl DevAddr

Source

pub const fn from_u32(raw: u32) -> Self

Create a device address from a raw integer.

Source

pub const fn const_from_ptr(ptr: *mut u8) -> Self

Create a device address from a pointer (only on 32-bit platforms).

Source

pub fn from_ptr(ptr: *mut u8) -> Self

Create a device address from a pointer.

Source

pub fn as_u32(&self) -> u32

Get the device address as a raw integer.

Source

pub fn as_ptr(&self) -> *mut u8

Get the device address as a pointer.

Trait Implementations§

Source§

impl Clone for DevAddr

Source§

fn clone(&self) -> DevAddr

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 DevAddr

Source§

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

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

impl Copy for DevAddr

Source§

impl Sync for DevAddr

Pointers are not sync, but we necessarily need pointers stored in statics.

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.