use ::core::convert::TryInto; use edyn::edyn; mod core {} struct MyImplementorA {} impl MyBehavior for MyImplementorA { fn my_trait_method(&self) {} } struct MyImplementorB {} impl MyBehavior for MyImplementorB { fn my_trait_method(&self) {} } #[edyn] enum MyBehaviorEnum { MyImplementorA, MyImplementorB, } #[edyn(MyBehaviorEnum)] trait MyBehavior { fn my_trait_method(&self); } #[test] fn main() { let a: MyBehaviorEnum = MyImplementorA {}.into(); a.my_trait_method(); let _a: MyImplementorA = a.try_into().unwrap(); }