use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::core::iter::Extend<__A> for Enum where A: ::core::iter::Extend<__A>, B: ::core::iter::Extend<__A>, { #[inline] fn extend<__T: ::core::iter::IntoIterator>(&mut self, iter: __T) { match self { Enum::A(x) => >::extend(x, iter), Enum::B(x) => >::extend(x, iter), } } } fn main() {}