#[repr(transparent)]
pub struct VolBlock<T, R, W, const C: usize> { /* private fields */ }
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 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

Constructs the value.

Safety
  • As per the type docs.

The length of this block (in elements).

Converts the VolBlock the usize for the start of the block.

Converts the VolBlock into an individual const pointer.

This should usually only be used when you need to call a foreign function that expects a pointer.

Converts the VolBlock into an individual mut pointer.

This should usually only be used when you need to call a foreign function that expects a pointer.

Converts the VolBlock into a const slice pointer.

This should usually only be used when you need to call a foreign function that expects a pointer.

Converts the VolBlock into an individual mut pointer.

This should usually only be used when you need to call a foreign function that expects a pointer.

Indexes to the ith position of the memory block.

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

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

Creates an iterator over the addresses of the memory block.

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.

Casts a block to an address to an equivalent sized array.

Safety
  • As per the general VolAddress construction rules.
  • It is highly likely that on any device this is safe, but because of possible strangeness with volatile side effects this is marked as an unsafe method.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
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
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Formats the value using the given formatter.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.