as_base_slice_mut

Function as_base_slice_mut 

Source
pub const unsafe fn as_base_slice_mut<Base, BaseArray>(
    buf: &mut [BaseArray],
) -> &mut [Base]
Expand description

Reinterpret a mutable slice of BaseArray elements as a slice of Base elements

This is useful to convert &[F; N] to &[F] or &[A] to &[F] where A has the same size, alignment and memory layout as [F; N] for some N.

§Safety

This is assumes that BaseArray has the same alignment and memory layout as [Base; N]. As Rust guarantees that arrays elements are contiguous in memory and the alignment of the array is the same as the alignment of its elements, this means that BaseArray must have the same alignment as Base.

§Panics

This panics if the size of BaseArray is not a multiple of the size of Base.