Skip to main content

alloc_once

Macro alloc_once 

Source
alloc_once!() { /* proc-macro */ }
Expand description

Allocate several (possibly different-typed) values in a single bump allocation and return a guard that owns the backing arena.

let mut guard = alloc_once!(1i32, "hi", [0u8; 4]);
let (a, b, c) = &mut *guard; // a: &mut i32, b: &mut &str, c: &mut [u8; 4]