pub trait CollectIntoAllocVec: IndexedParallelIterator {
// Required method
fn collect_into_alloc_vec<A: Allocator>(
self,
alloc: &A,
) -> A::Vec<Self::Item>;
}Expand description
Collects a parallel iterator into a buffer drawn from an Allocator.
The allocator’s counterpart to [IndexedParallelIterator::collect_into_vec], which targets a
&mut Vec that a generic buffer is not. The buffer is sized to the iterator’s length, and its
uninitialized capacity is written in parallel rather than zero-filled first.
Required Methods§
Sourcefn collect_into_alloc_vec<A: Allocator>(self, alloc: &A) -> A::Vec<Self::Item>
fn collect_into_alloc_vec<A: Allocator>(self, alloc: &A) -> A::Vec<Self::Item>
Allocates a buffer holding one element per item and fills it with the iterator’s items.
use binius_compute::{CollectIntoAllocVec, GlobalAllocator};
use rayon::prelude::*;
let squares = (0..8usize).into_par_iter().map(|i| i * i);
let buffer = squares.collect_into_alloc_vec(&GlobalAllocator);
assert_eq!(&*buffer, &[0, 1, 4, 9, 16, 25, 36, 49]);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".