Skip to content

Latest commit

 

History

History
47 lines (40 loc) · 1.19 KB

ParallelIterator.md

File metadata and controls

47 lines (40 loc) · 1.19 KB

When deriving for enum like the following:

#[enum_derive(rayon::ParallelIterator)]
enum Enum<A, B> {
    A(A),
    B(B),
}

Code like this will be generated:

enum Enum<A, B> {
    A(A),
    B(B),
}

impl<A, B> ::rayon::iter::ParallelIterator for Enum<A, B>
where
    A: ::rayon::iter::ParallelIterator,
    B: ::rayon::iter::ParallelIterator<Item = <A as ::rayon::iter::ParallelIterator>::Item>,
{
    type Item = <A as ::rayon::iter::ParallelIterator>::Item;

    #[inline]
    fn drive_unindexed<__C>(self, consumer: __C) -> __C::Result
    where
        __C: ::rayon::iter::plumbing::UnindexedConsumer<Self::Item>,
    {
        match self {
            Enum::A(x) => ::rayon::iter::ParallelIterator::drive_unindexed(x, consumer),
            Enum::B(x) => ::rayon::iter::ParallelIterator::drive_unindexed(x, consumer),
        }
    }

    #[inline]
    fn opt_len(&self) -> ::core::option::Option<usize> {
        match self {
            Enum::A(x) => ::rayon::iter::ParallelIterator::opt_len(x),
            Enum::B(x) => ::rayon::iter::ParallelIterator::opt_len(x),
        }
    }
}