default-boxed 0.2.0

Helper trait to help create large struct on heap directly
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use default_boxed::DefaultBoxed;

#[test]
fn test_boxed_array() {
    struct Foo(u32);

    impl Default for Foo {
        fn default() -> Self {
            Foo(0x12345678)
        }
    }

    let array = Foo::default_boxed_array::<1024>();
    assert!(array.iter().all(|item| item.0 == 0x12345678));
}