SharedMmioPointer

Struct SharedMmioPointer 

Source
pub struct SharedMmioPointer<'a, T: ?Sized> { /* private fields */ }
Expand description

A shared pointer to the registers of some MMIO device.

It is guaranteed to be valid but unlike UniqueMmioPointer may not be unique.

Implementations§

Source§

impl<T> SharedMmioPointer<'_, T>

Source

pub unsafe fn read_unsafe(&self) -> T

Performs an MMIO read of the entire T.

§Safety

This field must be safe to perform an MMIO read from, and doing so must not cause any side-effects.

Source§

impl<'a, T: ?Sized> SharedMmioPointer<'a, T>

Source

pub const unsafe fn child<U: ?Sized>( &self, regs: NonNull<U>, ) -> SharedMmioPointer<'a, U>

Creates a new SharedMmioPointer with the same lifetime as this one.

This is used internally by the field_shared! macro and shouldn’t be called directly.

§Safety

regs must be a properly aligned and valid pointer to some MMIO address space of type T, within the allocation that self points to.

Source

pub const fn ptr(&self) -> *const T

Returns a raw const pointer to the MMIO registers.

Source§

impl<T: FromBytes + IntoBytes> SharedMmioPointer<'_, ReadPure<T>>

Source

pub fn read(&self) -> T

Performs an MMIO read of the entire T.

Source§

impl<T: FromBytes + IntoBytes> SharedMmioPointer<'_, ReadPureWrite<T>>

Source

pub fn read(&self) -> T

Performs an MMIO read of the entire T.

Source§

impl<'a, T> SharedMmioPointer<'a, [T]>

Source

pub const fn get(&self, index: usize) -> Option<SharedMmioPointer<'a, T>>

Returns a SharedMmioPointer to an element of this slice, or None if the index is out of bounds.

Source

pub const fn len(&self) -> usize

Returns the length of the slice.

Source

pub const fn is_empty(&self) -> bool

Returns whether the slice is empty.

Source§

impl<'a, T, const LEN: usize> SharedMmioPointer<'a, [T; LEN]>

Source

pub fn split(&self) -> [SharedMmioPointer<'a, T>; LEN]

Splits a SharedMmioPointer to an array into an array of SharedMmioPointers.

Source

pub const fn as_slice(&self) -> SharedMmioPointer<'a, [T]>

Converts this array pointer to an equivalent slice pointer.

Source

pub const fn get(&self, index: usize) -> Option<SharedMmioPointer<'a, T>>

Returns a SharedMmioPointer to an element of this array, or None if the index is out of bounds.

Trait Implementations§

Source§

impl<T: ?Sized> Clone for SharedMmioPointer<'_, T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl<T: ?Sized> Debug for SharedMmioPointer<'_, T>

Source§

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

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

impl<'a, T: ?Sized> From<&'a T> for SharedMmioPointer<'a, T>

Source§

fn from(r: &'a T) -> Self

Converts to this type from the input type.
Source§

impl<'a, T, const LEN: usize> From<SharedMmioPointer<'a, [T; LEN]>> for SharedMmioPointer<'a, [T]>

Source§

fn from(value: SharedMmioPointer<'a, [T; LEN]>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<SharedMmioPointer<'a, T>> for SharedMmioPointer<'a, [T]>

Source§

fn from(value: SharedMmioPointer<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<SharedMmioPointer<'a, T>> for SharedMmioPointer<'a, [T; 1]>

Source§

fn from(value: SharedMmioPointer<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: ?Sized> From<UniqueMmioPointer<'a, T>> for SharedMmioPointer<'a, T>

Source§

fn from(unique: UniqueMmioPointer<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<T: ?Sized> PartialEq for SharedMmioPointer<'_, T>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: ?Sized> Copy for SharedMmioPointer<'_, T>

Source§

impl<T: ?Sized> Eq for SharedMmioPointer<'_, T>

Source§

impl<T: ?Sized + Send + Sync> Send for SharedMmioPointer<'_, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for SharedMmioPointer<'a, T>
where T: ?Sized,

§

impl<'a, T> RefUnwindSafe for SharedMmioPointer<'a, T>
where T: RefUnwindSafe + ?Sized,

§

impl<'a, T> !Sync for SharedMmioPointer<'a, T>

§

impl<'a, T> Unpin for SharedMmioPointer<'a, T>
where T: ?Sized,

§

impl<'a, T> UnwindSafe for SharedMmioPointer<'a, T>
where T: RefUnwindSafe + ?Sized,

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

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

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.