Struct d1_pac::generic::ArrayProxy

source ·
pub struct ArrayProxy<T, const COUNT: usize, const STRIDE: usize> { /* private fields */ }
Expand description

Access an array of COUNT items of type T with the items STRIDE bytes apart. This is a zero-sized-type. No objects of this type are ever actually created, it is only a convenience for wrapping pointer arithmetic.

There is no safe way to produce items of this type. Unsafe code can produce references by pointer casting. It is up to the unsafe code doing that, to ensure that the memory really is backed by appropriate content.

Typically, this is used for accessing hardware registers.

Implementations§

source§

impl<T, const C: usize, const S: usize> ArrayProxy<T, C, S>

source

pub unsafe fn get_ref(&self, index: usize) -> &T

Get a reference from an ArrayProxy with no bounds checking.

source

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

Get a reference from an ArrayProxy, or return None if the index is out of bounds.

source

pub fn len(&self) -> usize

Return the number of items.

Trait Implementations§

source§

impl<T, const C: usize, const S: usize> Index<usize> for ArrayProxy<T, C, S>

§

type Output = T

The returned type after indexing.
source§

fn index(&self, index: usize) -> &T

Performs the indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T, const COUNT: usize, const STRIDE: usize> Freeze for ArrayProxy<T, COUNT, STRIDE>

§

impl<T, const COUNT: usize, const STRIDE: usize> RefUnwindSafe for ArrayProxy<T, COUNT, STRIDE>
where T: RefUnwindSafe,

§

impl<T, const COUNT: usize, const STRIDE: usize> Send for ArrayProxy<T, COUNT, STRIDE>
where T: Send,

§

impl<T, const COUNT: usize, const STRIDE: usize> Sync for ArrayProxy<T, COUNT, STRIDE>
where T: Sync,

§

impl<T, const COUNT: usize, const STRIDE: usize> Unpin for ArrayProxy<T, COUNT, STRIDE>
where T: Unpin,

§

impl<T, const COUNT: usize, const STRIDE: usize> UnwindSafe for ArrayProxy<T, COUNT, STRIDE>
where T: UnwindSafe,

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

§

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

§

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.