pub unsafe fn reconstitute_from_base<Base, BaseArray: Clone>(
vec: Vec<Base>,
) -> Vec<BaseArray>Expand description
Convert a vector of Base elements to a vector of BaseArray elements ideally without any
reallocations.
This is an inverse of flatten_to_base. Unfortunately, unlike flatten_to_base, it may not be
possible to avoid allocations. This issue is that there is not way to guarantee that the capacity
of the vector is a multiple of d.
§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.
This panics if the length of the vector is not a multiple of the ratio of the sizes.