// we need a local variable for the accumulated results // we call the reducer's identity by splitting at 0 let (left_consumer, right_consumer, _) = consumer.split_at(0); letmut leftmost_res = left_consumer.into_folder().complete();
consumer = right_consumer;
// now we loop on each block size while remaining_len > 0 && !consumer.full() { // we compute the next block's size let size = self.sizes.next().unwrap_or(std::usize::MAX); let capped_size = remaining_len.min(size);
remaining_len -= capped_size;
// split the producer let (left_producer, right_producer) = producer.split_at(capped_size);
producer = right_producer;
// split the consumer let (left_consumer, right_consumer, _) = consumer.split_at(capped_size);
consumer = right_consumer;
/// `ExponentialBlocks` is a parallel iterator that consumes itself as a sequence /// of parallel blocks of increasing sizes (exponentially). /// /// This struct is created by the [`by_exponential_blocks()`] method on [`IndexedParallelIterator`] /// /// [`by_exponential_blocks()`]: trait.IndexedParallelIterator.html#method.by_exponential_blocks /// [`IndexedParallelIterator`]: trait.IndexedParallelIterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Debug, Clone)] pubstruct ExponentialBlocks<I> {
base: I,
}
/// `UniformBlocks` is a parallel iterator that consumes itself as a sequence /// of parallel blocks of constant sizes. /// /// This struct is created by the [`by_uniform_blocks()`] method on [`IndexedParallelIterator`] /// /// [`by_uniform_blocks()`]: trait.IndexedParallelIterator.html#method.by_uniform_blocks /// [`IndexedParallelIterator`]: trait.IndexedParallelIterator.html #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] #[derive(Debug, Clone)] pubstruct UniformBlocks<I> {
base: I,
block_size: usize,
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.