use edyn::edyn; struct Nothing; struct One(u8); struct Array([u8; N]); impl Trait for Nothing { fn get_array(&self) -> [u8; N] { [0; N] } } impl Trait for One { fn get_array(&self) -> [u8; N] { [self.0; N] } } impl Trait for Array { fn get_array(&self) -> [u8; N] { self.0 } } impl Trait for Vec { fn get_array(&self) -> [u8; N] { [self.len() as u8; N] } } #[edyn(Enum)] trait Trait { fn get_array(&self) -> [u8; N]; } #[edyn] enum Enum { Nothing, One, Array(Array), L(Vec), } #[test] fn main() { let three: Enum<(), 3, b'0', true> = One(2).into(); let eight: Enum = One(3).into(); assert_eq!(three.get_array(), [2, 2, 2]); assert_eq!(eight.get_array(), [3, 3, 3, 3, 3, 3, 3, 3]); }