Struct voladdress::VolBlock [−][src]
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
impl<T, R, W, const C: usize> VolBlock<T, R, W, C>
[src]
#[must_use]pub const unsafe fn new(base: usize) -> Self
[src]
#[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 i
th 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 i
th 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]
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.
Trait Implementations
impl<T, R, W, const C: usize> Clone for VolBlock<T, R, W, C>
[src]
#[must_use]fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord, R: Ord, W: Ord, const C: usize> Ord for VolBlock<T, R, W, C>
[src]
fn cmp(&self, other: &VolBlock<T, R, W, C>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq, R: PartialEq, W: PartialEq, const C: usize> PartialEq<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>
[src]
fn eq(&self, other: &VolBlock<T, R, W, C>) -> bool
[src]
fn ne(&self, other: &VolBlock<T, R, W, C>) -> bool
[src]
impl<T: PartialOrd, R: PartialOrd, W: PartialOrd, const C: usize> PartialOrd<VolBlock<T, R, W, C>> for VolBlock<T, R, W, C>
[src]
fn partial_cmp(&self, other: &VolBlock<T, R, W, C>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[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,
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,
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,
R: Unpin,
T: Unpin,
W: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,