orx_parallel/runner/implementations/
sequential.rs1use crate::ParThreadPool;
2use core::num::NonZeroUsize;
3
4#[derive(Default)]
14pub struct SequentialPool;
15
16impl ParThreadPool for SequentialPool {
17 type ScopeRef<'s, 'env, 'scope>
18 = ()
19 where
20 'scope: 's,
21 'env: 'scope + 's;
22
23 fn run_in_scope<'s, 'env, 'scope, W>(_: &Self::ScopeRef<'s, 'env, 'scope>, work: W)
24 where
25 'scope: 's,
26 'env: 'scope + 's,
27 W: Fn() + Send + 'scope + 'env,
28 {
29 work()
30 }
31
32 fn scoped_computation<'env, 'scope, F>(&'env mut self, f: F)
33 where
34 'env: 'scope,
35 for<'s> F: FnOnce(()) + Send,
36 {
37 f(())
38 }
39
40 fn max_num_threads(&self) -> NonZeroUsize {
41 NonZeroUsize::new(1).expect(">0")
42 }
43}