Skip to main content

EvalScheduler

Trait EvalScheduler 

Source
pub trait EvalScheduler: Debug + Send {
    // Required methods
    fn workers(&self) -> usize;
    fn run(
        &self,
        buckets: &mut [EvalBucket],
        eval: &(dyn Fn(&mut EvalBucket) + Send + Sync),
    );
}
Expand description

Runs a tick’s evaluation buckets, in any order and on any thread.

The buckets share nothing: each reads only the tick’s starting state and writes only its own effects, so a host with a thread pool can work them through in parallel. A world whose host installs none evaluates every run on the calling thread.

Required Methods§

Source

fn workers(&self) -> usize

How many buckets to split a tick’s firing instances into.

Source

fn run( &self, buckets: &mut [EvalBucket], eval: &(dyn Fn(&mut EvalBucket) + Send + Sync), )

Apply eval to every bucket, then return.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§