Expand description
Mostly safe no_std wrapper for alloca in Rust.
This crate uses Rust lifetime system to ensure that stack allocated memory will not be used after function return, but it does not make any guarantee about memory that is turned into raw pointer and stored somewhere else.
§Example
// allocate 128 bytes on the stack
alloca::with_alloca(128, |memory| {
// memory: &mut [MaybeUninit<u8>]
assert_eq!(memory.len(), 128);
});Functions§
- alloca
- Allocates
Ton stack space. - with_
alloca - Allocates
[u8; size]memory on stack and invokesclosurewith this slice as argument. - with_
alloca_ zeroed - Same as
with_allocaexcept it zeroes memory slice.