Function stackalloc::stackalloc_with

source ยท
pub fn stackalloc_with<T, U, F, I>(size: usize, init_with: I, callback: F) -> U
where F: FnOnce(&mut [T]) -> U, I: FnMut() -> T,
Expand description

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

The slice is aligned to type T.

See alloca().