Function dyn_stack::uninit_mem
source · [−]Expand description
Allocate a memory buffer with sufficient storage for the given stack requirements, using the global allocator.
Calls [std::alloc::handle_alloc_error
] in the case of failure.
Example
#![feature(allocator_api)]
use dynstack::{DynStack, StackReq, uninit_mem};
let req = StackReq::new::<i32>(3);
let mut buf = uninit_mem(req);
let stack = DynStack::new(&mut buf);
// use the stack
let (arr, _) = stack.make_with::<i32, _>(3, |i| i as i32);