WorkStealingTask

Trait WorkStealingTask 

Source
pub trait WorkStealingTask: Send + 'static {
    type Output: Send;

    // Required method
    fn execute(&mut self) -> Self::Output;

    // Provided methods
    fn estimated_cost(&self) -> f64 { ... }
    fn can_subdivide(&self) -> bool { ... }
    fn subdivide(&self) -> Vec<Box<dyn WorkStealingTask<Output = Self::Output>>>
       where Self: Sized { ... }
}
Expand description

Generic task that can be executed by the work-stealing scheduler

Required Associated Types§

Required Methods§

Source

fn execute(&mut self) -> Self::Output

Execute the task

Provided Methods§

Source

fn estimated_cost(&self) -> f64

Estimate computational cost (for load balancing)

Source

fn can_subdivide(&self) -> bool

Check if task can be subdivided for better load balancing

Source

fn subdivide(&self) -> Vec<Box<dyn WorkStealingTask<Output = Self::Output>>>
where Self: Sized,

Subdivide task into smaller tasks (if possible)

Implementors§

Source§

impl<F, R> WorkStealingTask for Task<F, R>
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,

Source§

impl<F: IntegrateFloat + Send, Func> WorkStealingTask for AdaptiveIntegrationTask<F, Func>
where Func: Fn(F) -> F + Send + Clone + 'static,