pub trait ParCollection: ConcurrentCollection {
// Provided method
fn par(
&self,
) -> ParIter<<Self::Iterable<'_> as ConcurrentIterable>::Iter, Id<&Self::Item>> { ... }
}Expand description
A collection from which a parallel iterator can be created repeatedly
using par() method.
Sequential counterpart: iter().
Provided Methods§
Sourcefn par(
&self,
) -> ParIter<<Self::Iterable<'_> as ConcurrentIterable>::Iter, Id<&Self::Item>>
fn par( &self, ) -> ParIter<<Self::Iterable<'_> as ConcurrentIterable>::Iter, Id<&Self::Item>>
Returns a parallel iterator over shared references to collection items.
§Example
use orx_parallel::*;
let values = vec![1, 2, 3, 4];
let sum: i32 = ParCollection::par(&values).copied().sum();
assert_eq!(sum, 10);
// alternatively
let sum: i32 = values.par().copied().sum();
assert_eq!(sum, 10);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".