pub fn stackalloc_with_default<T, U, F>(size: usize, callback: F) -> U where
    F: FnOnce(&mut [T]) -> U,
    T: Default
Expand description

Allocate a runtime length slice of T on the stack, fill it by calling T::default(), call callback with this buffer, and then drop and deallocate the buffer.

The slice is aligned to type T.

See alloca().