rayon::iter::plumbing

Function bridge_producer_consumer

Source
pub fn bridge_producer_consumer<P, C>(
    len: usize,
    producer: P,
    consumer: C,
) -> C::Result
where P: Producer, C: Consumer<P::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.