pub enum NumJobs {
Auto,
Explicit(NonZeroUsize),
}Expand description
Parsed worker-count selector for ConcurrentRunner, shared by the
bca CLI and the bca-web server so both binaries resolve the same
<N|auto> contract.
Auto is the default and resolves to the OS-reported effective CPU
count via std::thread::available_parallelism, which honors Linux
cgroup CPU quotas, cgroup v2 cpu.max, and sched_setaffinity
cpusets. On macOS / Windows it falls back to the OS CPU count.
Explicit(n) is an integer override; NumJobs::from_str rejects
0 with a clear error message rather than silently degrading to
serial mode.
This type is intentionally clap-agnostic — it is a plain FromStr
the binaries wire into clap via value_parser / value_name, so the
core library gains no clap dependency.
Variants§
Auto
Use the OS-reported effective CPU count (cgroup / cpuset aware).
Explicit(NonZeroUsize)
Use an explicit, non-zero worker count.
Implementations§
Source§impl NumJobs
impl NumJobs
Sourcepub fn resolve(self) -> usize
pub fn resolve(self) -> usize
Resolve to the worker count handed to ConcurrentRunner.
Auto falls back to 1 if available_parallelism errors —
keeping the caller alive even in unusual sandboxes where the
syscall fails. The returned value is always >= 1.
Trait Implementations§
impl Copy for NumJobs
impl Eq for NumJobs
impl StructuralPartialEq for NumJobs
Auto Trait Implementations§
impl Freeze for NumJobs
impl RefUnwindSafe for NumJobs
impl Send for NumJobs
impl Sync for NumJobs
impl Unpin for NumJobs
impl UnsafeUnpin for NumJobs
impl UnwindSafe for NumJobs
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.