Skip to main content

ParallelRunner

Trait ParallelRunner 

Source
pub trait ParallelRunner: Send + Sync {
    // Required method
    fn run_shards(
        &self,
        n: usize,
        f: &(dyn Fn(usize) -> Box<dyn Any + Send> + Sync),
    ) -> Vec<Box<dyn Any + Send>>;
}
Expand description

v7.39 (parallel-agg P0) — host-injected parallel executor. The engine is no_std and cannot spawn threads; like ClockFn / RandomFn, the std-side host (spg-server / embedded-tokio) injects an implementation at startup. None (the default, and the only option in pure-no_std embeddings) keeps every code path single-threaded and byte-identical to pre-P0 behaviour.

The callback returns Box<dyn Any + Send> so one trait serves any shard-result type; call sites downcast what they produced.

Required Methods§

Source

fn run_shards( &self, n: usize, f: &(dyn Fn(usize) -> Box<dyn Any + Send> + Sync), ) -> Vec<Box<dyn Any + Send>>

Run f(0) .. f(n-1), possibly concurrently; return the results in shard order. Every call completes before return.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§