Skip to main content

box/
box.rs

1use zigzag_alloc::alloc::system::SystemAllocator;
2use zigzag_alloc::collections::ExBox;
3
4fn main() {
5    let alloc = SystemAllocator;
6
7    let boxed_int = ExBox::new(1337, &alloc).expect("Out of memory");
8
9    println!("Value: {}", *boxed_int);
10    
11    let val = ExBox::unbox(boxed_int);
12    println!("Unboxed: {}", val);
13}