#![cfg(feature = "auto_enums")] use std::sync::Arc; use edyn::edyn; #[edyn] trait Trait { fn foo(&self) -> impl Iterator; } struct Impl1; impl Trait for Impl1 { fn foo(&self) -> impl Iterator { 1.. } } struct Impl2; impl Trait for Impl2 { fn foo(&self) -> impl Iterator { 2..10 } } #[edyn(Trait)] enum Item { Impl1(Impl1), Impl2(Impl2) } #[test] fn main() { assert_eq!(Item::from(Impl1{}).foo().next().unwrap(), 1); assert_eq!(Item::from(Impl2{}).foo().next().unwrap(), 2); }