Function maybe_rayon::iter::plumbing::bridge_producer_consumer
source · pub fn bridge_producer_consumer<P, C>(
len: usize,
producer: P,
consumer: C
) -> <C as Consumer<<P as Producer>::Item>>::Resultwhere
P: Producer,
C: Consumer<<P as Producer>::Item>,
Expand description
This helper function is used to “connect” a producer and a
consumer. You may prefer to call bridge
, which wraps this
function. This function will draw items from producer
and feed
them to consumer
, splitting and creating parallel tasks when
needed.
This is useful when you are implementing your own parallel
iterators: it is often used as the definition of the
drive_unindexed
or drive
methods.