Trait rayon::iter::unzip::UnzipOp

source ·
trait UnzipOp<T>: Sync + Send {
    type Left: Send;
    type Right: Send;

    // Required method
    fn consume<FA, FB>(&self, item: T, left: FA, right: FB) -> (FA, FB)
       where FA: Folder<Self::Left>,
             FB: Folder<Self::Right>;

    // Provided method
    fn indexable() -> bool { ... }
}
Expand description

This trait abstracts the different ways we can “unzip” one parallel iterator into two distinct consumers, which we can handle almost identically apart from how to process the individual items.

Required Associated Types§

source

type Left: Send

The type of item expected by the left consumer.

source

type Right: Send

The type of item expected by the right consumer.

Required Methods§

source

fn consume<FA, FB>(&self, item: T, left: FA, right: FB) -> (FA, FB)
where FA: Folder<Self::Left>, FB: Folder<Self::Right>,

Consumes one item and feeds it to one or both of the underlying folders.

Provided Methods§

source

fn indexable() -> bool

Reports whether this op may support indexed consumers.

  • e.g. true for unzip where the item count passed through directly.
  • e.g. false for partition where the sorting is not yet known.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<A: Send, B: Send> UnzipOp<(A, B)> for Unzip

§

type Left = A

§

type Right = B

source§

impl<L, R> UnzipOp<Either<L, R>> for UnEither
where L: Send, R: Send,

§

type Left = L

§

type Right = R

source§

impl<P, L, R, T> UnzipOp<T> for PartitionMap<P>
where P: Fn(T) -> Either<L, R> + Sync + Send, L: Send, R: Send,

§

type Left = L

§

type Right = R

source§

impl<P, T> UnzipOp<T> for Partition<P>
where P: Fn(&T) -> bool + Sync + Send, T: Send,

§

type Left = T

§

type Right = T