Struct voladdress::VolBlock [−][src]
#[repr(transparent)]pub struct VolBlock<T, R, W, const C: usize> { /* fields omitted */ }
Expand description
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 theVolAddress
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 theT
type, starting from the base address. - The memory block must not wrap around past the end of the address space.
Implementations
Indexes to the i
th position of the memory block.
Panics
- If the index is out of bounds this will panic.
Gets the address of the i
th position, if it’s in bounds.
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>;
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>;
Creates an iterator over the addresses of the memory block.
pub fn iter_range<RB: RangeBounds<usize>>(self, r: RB) -> 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>;
pub fn iter_range<RB: RangeBounds<usize>>(self, r: RB) -> 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>;
Makes an iterator over the range bounds given.
If the range given is empty then your iterator will be empty.
Panics
- If the start or end of the range are out of bounds for the block.
Trait Implementations
impl<T: PartialOrd, R: PartialOrd, W: PartialOrd, const C: usize> PartialOrd<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>
impl<T: PartialOrd, R: PartialOrd, W: PartialOrd, const C: usize> PartialOrd<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more