Expand description
Explicit bounded execution contexts for native PhaseSmith kernels.
This crate owns reusable Rayon pools instead of installing or modifying the
process-global pool. It gives desktop applications, services, Python
adapters, and tests the same deterministic worker-budget contract.
Applications normally use it through
phasesmith::execution.
§Example
use phasesmith_execution::ExecutionPolicy;
let policy = ExecutionPolicy::new(Some(4), 2)?;
let results = policy.context().map_ordered(4, 2, |index| index * index);
assert_eq!(results, [0, 1, 4, 9]);
assert!(policy.resolved_budget() >= 1);requested_threads = None selects available logical parallelism. Fixed
requests are capped to what the process reports as available. Work below
minimum_parallel_tasks remains serial, and ordered mapping always returns
results in input order.
Structs§
- Execution
Context - Reusable, operation-owned worker pool with deterministic ordered mapping.
- Execution
Policy - Immutable worker-budget policy with one persistent bounded execution pool.
Enums§
- Execution
Policy Error - Invalid or unconstructable native execution policy.
Constants§
- DEFAULT_
EXECUTION_ THREADS - Default fixed worker budget used by scripts and applications.
- DEFAULT_
MINIMUM_ PARALLEL_ TASKS - Default number of independent tasks required before parallel scheduling.