Struct voladdress::VolSeries

source ·
#[repr(transparent)]
pub struct VolSeries<T, R, W, const C: usize, const S: usize> { /* private fields */ }
Expand description

A volatile memory “series”.

This is intended to model when a portion of memory is a series of evenly spaced values that are not directly contiguous.

Generic Parameters

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

Safety

  • This type stores a 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 values of the T type, spaced every S bytes, starting from the base address.
  • The memory series must not wrap around the end of the address space.

Implementations§

source§

impl<T, R, W, const C: usize, const S: usize> VolSeries<T, R, W, C, S>

source

pub const unsafe fn new(base: usize) -> Self

Constructs the value.

Safety
  • As per the type docs.
source

pub const fn len(self) -> usize

The length of this series (in elements).

source

pub const fn stride(self) -> usize

The stride of this series (in bytes).

source

pub const fn index(self, i: usize) -> VolAddress<T, R, W>

Indexes to the ith position of the memory series.

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

pub const fn get(self, i: usize) -> Option<VolAddress<T, R, W>>

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

source

pub const fn iter(self) -> VolSeriesIter<T, R, W, S>

Creates an iterator over the addresses of the memory series.

source

pub fn iter_range<RB: RangeBounds<usize>>( self, r: RB ) -> VolSeriesIter<T, R, W, S>

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

Trait Implementations§

source§

impl<T, R, W, const C: usize, const S: usize> Clone for VolSeries<T, R, W, C, S>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T, R, W, const C: usize, const S: usize> Debug for VolSeries<T, R, W, C, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: Hash, R: Hash, W: Hash, const C: usize, const S: usize> Hash for VolSeries<T, R, W, C, S>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Ord, R: Ord, W: Ord, const C: usize, const S: usize> Ord for VolSeries<T, R, W, C, S>

source§

fn cmp(&self, other: &VolSeries<T, R, W, C, S>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<T: PartialEq, R: PartialEq, W: PartialEq, const C: usize, const S: usize> PartialEq<VolSeries<T, R, W, C, S>> for VolSeries<T, R, W, C, S>

source§

fn eq(&self, other: &VolSeries<T, R, W, C, S>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd, R: PartialOrd, W: PartialOrd, const C: usize, const S: usize> PartialOrd<VolSeries<T, R, W, C, S>> for VolSeries<T, R, W, C, S>

source§

fn partial_cmp(&self, other: &VolSeries<T, R, W, C, S>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T, R, W, const C: usize, const S: usize> Pointer for VolSeries<T, R, W, C, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter.
source§

impl<T, R, W, const C: usize, const S: usize> Copy for VolSeries<T, R, W, C, S>

source§

impl<T: Eq, R: Eq, W: Eq, const C: usize, const S: usize> Eq for VolSeries<T, R, W, C, S>

source§

impl<T, R, W, const C: usize, const S: usize> StructuralEq for VolSeries<T, R, W, C, S>

source§

impl<T, R, W, const C: usize, const S: usize> StructuralPartialEq for VolSeries<T, R, W, C, S>

Auto Trait Implementations§

§

impl<T, R, W, const C: usize, const S: usize> RefUnwindSafe for VolSeries<T, R, W, C, S>where R: RefUnwindSafe, T: RefUnwindSafe, W: RefUnwindSafe,

§

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

§

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

§

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

§

impl<T, R, W, const C: usize, const S: usize> UnwindSafe for VolSeries<T, R, W, C, S>where R: UnwindSafe, T: UnwindSafe, W: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.