Function stackalloc::stackalloc
source · [−]pub fn stackalloc<T, U, F>(size: usize, init: T, callback: F) -> U where
F: FnOnce(&mut [T]) -> U,
T: Clone,
Expand description
Allocate a runtime length slice of T
on the stack, fill it by cloning init
, call callback
with this buffer, and then drop and deallocate the buffer.
The slice is aligned to type T
.
See alloca()
.