parallel
parallel
Section titled “parallel”The std::core::parallel module is intended to expose data-parallel array
operations backed by the Rayon thread pool.
Import
Section titled “Import”use std::core::parallelPlanned Functions
Section titled “Planned Functions”parallel::map(array: Array<_>, callback) -> Array<_>
Section titled “parallel::map(array: Array<_>, callback) -> Array<_>”Map a function over an array in parallel.
parallel::filter(array: Array<_>, callback) -> Array<_>
Section titled “parallel::filter(array: Array<_>, callback) -> Array<_>”Filter an array with a predicate in parallel.
parallel::for_each(array: Array<_>, callback)
Section titled “parallel::for_each(array: Array<_>, callback)”Apply callback to each element for side effects in parallel.
parallel::reduce(array: Array<_>, callback, initial) -> _
Section titled “parallel::reduce(array: Array<_>, callback, initial) -> _”Reduce an array to a single value using callback(acc, elem) -> acc.
parallel::sort(array: Array<_>, comparator) -> Array<_>
Section titled “parallel::sort(array: Array<_>, comparator) -> Array<_>”Sort an array with a comparator (a, b) -> number; uses a parallel sort for
large inputs (1024+ elements).
parallel::chunks(array: Array<_>, size: int) -> Array<Array<_>>
Section titled “parallel::chunks(array: Array<_>, size: int) -> Array<Array<_>>”Split an array into chunks of size elements. The last chunk may be shorter
if array.length is not divisible by size.
parallel::num_threads() -> int
Section titled “parallel::num_threads() -> int”Return the number of threads in the Rayon pool.
See Also
Section titled “See Also”std::core::utils::rolling— rolling-window aggregations on numeric arrays- Async —
async scope,join, and structured concurrency for I/O parallelism