1#![warn(missing_docs)]
4
5use oxidd_core::{BroadcastContext, WorkerPool};
6
7pub mod edge;
8
9pub struct Workers;
11
12impl WorkerPool for Workers {
13 fn current_num_threads(&self) -> usize {
14 rayon::current_num_threads()
15 }
16
17 fn split_depth(&self) -> u32 {
18 42
19 }
20
21 fn set_split_depth(&self, _depth: Option<u32>) {}
22
23 fn install<R: Send>(&self, op: impl FnOnce() -> R + Send) -> R {
24 op()
25 }
26
27 fn join<RA: Send, RB: Send>(
28 &self,
29 op_a: impl FnOnce() -> RA + Send,
30 op_b: impl FnOnce() -> RB + Send,
31 ) -> (RA, RB) {
32 rayon::join(op_a, op_b)
33 }
34
35 fn broadcast<R: Send>(&self, op: impl Fn(oxidd_core::BroadcastContext) -> R + Sync) -> Vec<R> {
36 rayon::broadcast(|ctx| {
37 op(BroadcastContext {
38 index: ctx.index() as u32,
39 num_threads: ctx.num_threads() as u32,
40 })
41 })
42 }
43}