orx_parallel/runner/
parallel_task.rs

1/// A parallel task shared with threads.
2pub trait ParallelTask {
3    /// Item.
4    type Item;
5
6    /// Task to perform on a single `value`.
7    fn f1(&self, value: Self::Item);
8
9    /// Task to perform on a chunk of `values` with known length.
10    fn fc(&self, values: impl ExactSizeIterator<Item = Self::Item>);
11}
12
13/// A parallel task shared with threads, where indices are also used.
14pub trait ParallelTaskWithIdx {
15    /// Item.
16    type Item;
17
18    /// Task to perform on a single `value` with the given input `idx`.
19    fn f1(&self, idx: usize, value: Self::Item);
20
21    /// Task to perform on a chunk of `values` with known length starting at the given `begin_idx`.
22    fn fc(&self, begin_idx: usize, values: impl ExactSizeIterator<Item = Self::Item>);
23}