orx_parallel/runner/
num_spawned.rs

1/// Number of spawned threads to execute a parallel computation.
2#[derive(Clone, Copy)]
3pub struct NumSpawned(usize);
4
5impl NumSpawned {
6    /// Zero.
7    pub fn zero() -> Self {
8        Self(0)
9    }
10
11    /// Adds one to the spawned thread count.
12    pub fn increment(&mut self) {
13        self.0 += 1;
14    }
15
16    /// Converts into usize.
17    pub fn into_inner(self) -> usize {
18        self.0
19    }
20}
21
22impl core::ops::Rem for NumSpawned {
23    type Output = usize;
24
25    fn rem(self, rhs: Self) -> Self::Output {
26        self.0 % rhs.0
27    }
28}