Skip to content

parallel

The std::core::parallel module is intended to expose data-parallel array operations backed by the Rayon thread pool.

use std::core::parallel

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.

Return the number of threads in the Rayon pool.

  • std::core::utils::rolling — rolling-window aggregations on numeric arrays
  • Asyncasync scope, join, and structured concurrency for I/O parallelism