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