pub fn try_uninit_mem_in<A: Allocator>(
    alloc: A,
    req: StackReq
) -> Result<MemBuffer<A>, AllocError>
Expand description

Allocate a memory buffer with sufficient storage for the given stack requirements, using the provided allocator, or an AllocError in the case of failure.

Example

#![feature(allocator_api)]

use dynstack::{DynStack, StackReq, try_uninit_mem_in};
use std::alloc::Global;

let req = StackReq::new::<i32>(3);
let mut buf = try_uninit_mem_in(Global, req).unwrap();
let stack = DynStack::new(&mut buf);

// use the stack
let (arr, _) = stack.make_with::<i32, _>(3, |i| i as i32);