pub trait ParIntoCopied<'a, T>: Par<Item = &'a T>{
// Provided method
fn copied(self) -> impl Par<Item = T> { ... }
}
Expand description
Transforms a parallel iterator yielding &T into one that yields T by copying each element.
Transformation is via the copied
method.
§Examples
use orx_parallel::*;
let numbers = vec![1, 2, 3, 4];
let sum = numbers.par().copied().sum();
let product = numbers.par().copied().fold(|| 1, |x, y| x * y);
assert_eq!(sum, 10);
assert_eq!(product, 24);
Provided Methods§
Sourcefn copied(self) -> impl Par<Item = T>
fn copied(self) -> impl Par<Item = T>
Transforms a parallel iterator yielding &T into one that yields T by copying each element.
Transformation is via the copied
method.
§Examples
use orx_parallel::*;
let numbers = vec![1, 2, 3, 4];
let sum = numbers.par().copied().sum();
let product = numbers.par().copied().fold(|| 1, |x, y| x * y);
assert_eq!(sum, 10);
assert_eq!(product, 24);
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.