pub fn alloc_array<T, R, Consumer: FnOnce(UninitializedSliceMemoryGuard<'_, T>) -> R>(
    size: usize,
    consumer: Consumer
) -> R
Expand description

alloc_array is used when inplace_or_alloc_array realize that the size of requested array of T is too large and should be replaced in the heap.

It allocates a vector with size elements and fills it up with help of init closure and then pass a reference to a slice of the vector into the consumer closure. consumer’s result will be returned.