pub trait ExecutionPolicy:
Send
+ Sync
+ 'static {
// Required method
fn parallelize(len: usize) -> bool;
// Provided methods
fn parallelize_chunks(len: usize, chunks: usize) -> bool { ... }
fn parallelize_work(len: usize, chunks: usize, bytes: usize) -> bool { ... }
fn parallelize_pair() -> bool { ... }
}Expand description
Compile-time strategy selector for the data-parallel operations in this crate.
Implemented by zero-sized marker types; used purely as a type parameter so each operation monomorphizes to a single concrete path.
Required Methods§
Sourcefn parallelize(len: usize) -> bool
fn parallelize(len: usize) -> bool
Return true if an operation over len elements should run in parallel.
Provided Methods§
Sourcefn parallelize_chunks(len: usize, chunks: usize) -> bool
fn parallelize_chunks(len: usize, chunks: usize) -> bool
Return true if an operation over len elements, partitioned into
chunks logical chunks, should run in parallel.
The default preserves policies expressed only in terms of element count. Policies for chunked operations may override this method when chunk geometry also determines whether scheduling is worthwhile. An operator may coalesce logical chunks into fewer scheduled worker tasks.
Sourcefn parallelize_work(len: usize, chunks: usize, bytes: usize) -> bool
fn parallelize_work(len: usize, chunks: usize, bytes: usize) -> bool
Return true if an operation over len elements, scheduled as chunks
tasks and moving bytes in total, should run in parallel.
The default keeps policies expressed in element and chunk counts. A policy whose crossover is a quantity of data rather than a count of elements overrides this: a pass over wide elements, or over an output beside a wider input, moves more than its element count says (ADR 0059).
Sourcefn parallelize_pair() -> bool
fn parallelize_pair() -> bool
Return true if a fixed two-branch operation should run in parallel.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".