Struct voladdress::VolBlock[][src]

#[repr(transparent)]pub struct VolBlock<T, R, W, const C: usize> { /* fields omitted */ }

A volatile memory block.

This is intended to model when a portion of memory is an array of identical values in a row, such as a block of 256 u16 values in a row.

Generic Parameters

  • T / R / W: These parameters are applied to the VolAddress type returned when accessing the block in any way (indexing, iteration, etc).
  • C: the count of elements in the block.

Safety

  • This type stores a base VolAddress internally, and so you must follow all of those safety rules. Notably, the base address must never be zero.
  • The address space must legally contain C contiguous values of the T type, starting from the base address.
  • The memory block must not wrap around past the end of the address space.

Implementations

impl<T, R, W, const C: usize> VolBlock<T, R, W, C>[src]

#[must_use]pub const unsafe fn new(base: usize) -> Self[src]

Constructs the value.

Safety

  • As per the type docs.

#[must_use]pub const unsafe fn len(self) -> usize[src]

The length of this block (in elements).

#[must_use]pub const fn index(self, i: usize) -> VolAddress<T, R, W>[src]

Indexes to the ith position of the memory block.

Panics

  • If the index is out of bounds this will panic.

#[must_use]pub const fn get(self, i: usize) -> Option<VolAddress<T, R, W>>[src]

Gets the address of the ith position, if it’s in bounds.

#[must_use]pub const fn iter(self) -> VolBlockIter<T, R, W>

Notable traits for VolBlockIter<T, R, W>

impl<T, R, W> Iterator for VolBlockIter<T, R, W> type Item = VolAddress<T, R, W>;
[src]

Creates an iterator over the addresses of the memory block.

Trait Implementations

impl<T, R, W, const C: usize> Clone for VolBlock<T, R, W, C>[src]

impl<T, R, W, const C: usize> Copy for VolBlock<T, R, W, C>[src]

impl<T, R, W, const C: usize> Debug for VolBlock<T, R, W, C>[src]

impl<T: Eq, R: Eq, W: Eq, const C: usize> Eq for VolBlock<T, R, W, C>[src]

impl<T: Hash, R: Hash, W: Hash, const C: usize> Hash for VolBlock<T, R, W, C>[src]

impl<T: Ord, R: Ord, W: Ord, const C: usize> Ord for VolBlock<T, R, W, C>[src]

impl<T: PartialEq, R: PartialEq, W: PartialEq, const C: usize> PartialEq<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>[src]

impl<T: PartialOrd, R: PartialOrd, W: PartialOrd, const C: usize> PartialOrd<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>[src]

impl<T, R, W, const C: usize> StructuralEq for VolBlock<T, R, W, C>[src]

impl<T, R, W, const C: usize> StructuralPartialEq for VolBlock<T, R, W, C>[src]

Auto Trait Implementations

impl<T, R, W, const C: usize> Send for VolBlock<T, R, W, C> where
    R: Send,
    T: Send,
    W: Send

impl<T, R, W, const C: usize> Sync for VolBlock<T, R, W, C> where
    R: Sync,
    T: Sync,
    W: Sync

impl<T, R, W, const C: usize> Unpin for VolBlock<T, R, W, C> where
    R: Unpin,
    T: Unpin,
    W: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.