Struct RegArray

Source
pub struct RegArray<'a, P: ArrayElem<'a>, const N: usize> { /* private fields */ }
Expand description

An array of registers.

Element type can be:

  • a basic register of type Reg;
  • a custom register map (struct) implementing the trait RegMapPtr through the derive macro RegMap;
  • another RegArray (multidimensional array).

Implementations§

Source§

impl<'a, P: ArrayElem<'a>, const N: usize> RegArray<'a, P, N>

Source

pub const fn as_ptr(&self) -> *mut [P::Target; N]

Returns a raw pointer to the underlying pointer array.

Source

pub const fn len(&self) -> usize

Returns the number of pointers in the array.

Source

pub fn idx(&self, index: usize) -> P

Access the pointer at index.

§Panics

If index is out of bounds, i.e. if index >= N.

Source

pub unsafe fn idx_unchecked(&self, index: usize) -> P

Access the pointer at index, without doing bounds checking.

§Safety

index must be in bounds: index < N.

Source

pub fn iter( &self, ) -> impl 'a + ExactSizeIterator<Item = P> + DoubleEndedIterator + FusedIterator + Clone

Returns an iterator over the pointer array.

Source

pub fn iter_slice( &self, start: usize, end: usize, ) -> impl 'a + ExactSizeIterator<Item = P> + DoubleEndedIterator + FusedIterator + Clone

Returns an iterator over a subslice [start..end] of the pointer array.

§Panics

If [start..end] is out of bounds.

Trait Implementations§

Source§

impl<'a, T: ArrayElem<'a>, const N: usize> ArrayElem<'a> for RegArray<'a, T, N>

Source§

type Target = [<T as ArrayElem<'a>>::Target; N]

The target type of the pointer stored in the array.
Source§

unsafe fn from_nonnull(ptr: NonNull<Self::Target>) -> Self

Creates a new pointer to Self::Target. Read more

Auto Trait Implementations§

§

impl<'a, P, const N: usize> Freeze for RegArray<'a, P, N>

§

impl<'a, P, const N: usize> RefUnwindSafe for RegArray<'a, P, N>
where <P as ArrayElem<'a>>::Target: RefUnwindSafe,

§

impl<'a, P, const N: usize> !Send for RegArray<'a, P, N>

§

impl<'a, P, const N: usize> !Sync for RegArray<'a, P, N>

§

impl<'a, P, const N: usize> Unpin for RegArray<'a, P, N>

§

impl<'a, P, const N: usize> UnwindSafe for RegArray<'a, P, N>
where <P as ArrayElem<'a>>::Target: RefUnwindSafe,

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