without-alloc 0.2.2

Replacements for `Box`, `Rc`, `Vec`, .. without `alloc`
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use unsize::{Coercion, CoerceUnsize};
use without_alloc::{boxed::Box, Uninit};
use core::mem::MaybeUninit;

#[test]
fn unsizing() {
    let mut memory: MaybeUninit<usize> = MaybeUninit::uninit();
    let boxed = Box::new(0usize, Uninit::from(&mut memory));

    let debug: Box<dyn core::fmt::Debug> = boxed.unsize(Coercion::to_debug());

    assert_eq!(format!("{:?}", &*debug), "0");
}