dync 0.6.0

An efficient alternative to `dyn Trait` for containerized types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#![forbid(unsafe_code)]
use dync::*;

#[repr(align(256))]
#[derive(Copy, Clone)]
struct LargeAlign(u8);

// Test the soundness regression found in https://github.com/elrnv/dync/issues/4
#[test]
fn alignment() {
    let mut x: VecCopy = VecCopy::with_type::<LargeAlign>();
    x.push_as::<LargeAlign>(LargeAlign(0));

    let ref_to_element = x.get_ref_as::<LargeAlign>(0).unwrap();
    assert_eq!(ref_to_element.0, 0);
}