VolatileWriteSlice

Trait VolatileWriteSlice 

Source
pub trait VolatileWriteSlice<T, U>
where Self: AsMut<[T]>, T: VolatileWrite<U>, U: Copy,
{ // Provided methods fn fill_volatile(&mut self, val: U) { ... } fn write_slice_volatile(&mut self, src: &[U]) { ... } }
Expand description

Data which is, or can be treated as, a writable slice of volatile elements.

The data to be written is of type [U].

This trait has a blanket implementation for all types which meet the criteria.

Provided Methods§

Source

fn fill_volatile(&mut self, val: U)

Performs a volatile write of each element of the slice with the given value without reading the old data from self.

§Safety

Just like in C, whether an operation is volatile has no bearing whatsoever on questions involving concurrent access from multiple threads. Volatile accesses behave exactly like non-atomic accesses in that regard. In particular, a race between a write operation any other operation (reading or writing) to the same location is undefined behavior.

Source

fn write_slice_volatile(&mut self, src: &[U])

Performs a volatile write of each element of self, copying the data from src, without reading the old data from self.

The length of src must be the same as self.

§Panics

This function will panic if the two slices have different lengths.

§Safety

Just like in C, whether an operation is volatile has no bearing whatsoever on questions involving concurrent access from multiple threads. Volatile accesses behave exactly like non-atomic accesses in that regard. In particular, a race between a write operation any other operation (reading or writing) to the same location is undefined behavior.

Implementors§

Source§

impl<S, T, U> VolatileWriteSlice<T, U> for S
where S: AsMut<[T]>, T: VolatileWrite<U>, U: Copy,