#![allow(dead_code)] extern crate penum; use penum::penum; struct Al; struct Be(i32); struct Ce(String); #[penum] trait Echo { fn echo(&self) -> String; } #[penum] trait Special { fn ret(&self) -> Option<&String>; } #[penum] trait AsInner { fn as_inner(&self) -> &T; } impl Special for Ce { fn ret(&self) -> Option<&String> { Some(&self.0) } } impl AsInner for Be { fn as_inner(&self) -> &i32 { &self.0 } } #[penum(_ where Ce: ^Special, Be: ^AsInner)] enum Foo { V1(Al), V2(i32, Be), V3(Ce), V4 { name: String, age: Be, country: String, }, V5(Be, i32), V6(i32, i32, Be, i32), // V7(i32, Be, Be, i32), // TODO: Fix unreachable pattern } fn main() {}