extern crate rayon_crate as rayon; use auto_enums::enum_derive; enum Enum { A(A), B(B), } impl ::rayon::iter::ParallelIterator for Enum where A: ::rayon::iter::ParallelIterator, B: ::rayon::iter::ParallelIterator< Item = ::Item, >, { type Item = ::Item; #[inline] fn drive_unindexed<__C>(self, consumer: __C) -> __C::Result where __C: ::rayon::iter::plumbing::UnindexedConsumer, { match self { Enum::A(x) => { ::drive_unindexed(x, consumer) } Enum::B(x) => { ::drive_unindexed(x, consumer) } } } #[inline] fn opt_len(&self) -> ::core::option::Option { match self { Enum::A(x) => ::opt_len(x), Enum::B(x) => ::opt_len(x), } } } impl ::rayon::iter::IndexedParallelIterator for Enum where A: ::rayon::iter::IndexedParallelIterator, B: ::rayon::iter::IndexedParallelIterator< Item = ::Item, >, { #[inline] fn drive<__C>(self, consumer: __C) -> __C::Result where __C: ::rayon::iter::plumbing::Consumer, { match self { Enum::A(x) => { ::drive(x, consumer) } Enum::B(x) => { ::drive(x, consumer) } } } #[inline] fn len(&self) -> usize { match self { Enum::A(x) => ::len(x), Enum::B(x) => ::len(x), } } #[inline] fn with_producer<__CB>(self, callback: __CB) -> __CB::Output where __CB: ::rayon::iter::plumbing::ProducerCallback, { match self { Enum::A(x) => { ::with_producer(x, callback) } Enum::B(x) => { ::with_producer(x, callback) } } } } fn main() {}