pub struct ThreadPolicy {
pub threads_override: Option<usize>,
pub min_items_override: Option<usize>,
pub min_total_bytes_override: Option<usize>,
}Expand description
Explicit CLI or embedder overrides layered on top of config resolution.
Fields§
§threads_override: Option<usize>When set, replaces config-derived thread counts (0 = auto / all logical CPUs).
min_items_override: Option<usize>When set, replaces the operation’s default minimum item count before using a pool.
min_total_bytes_override: Option<usize>When set, replaces the byte threshold before using a pool (Some(0) disables it).
Implementations§
Source§impl ThreadPolicy
impl ThreadPolicy
Sourcepub fn with_threads_override(threads: Option<usize>) -> Self
pub fn with_threads_override(threads: Option<usize>) -> Self
Override worker count (None = use config only; Some(0) = auto).
Sourcepub fn with_min_items_override(min_items: Option<usize>) -> Self
pub fn with_min_items_override(min_items: Option<usize>) -> Self
Override minimum batch size (Some(0) forces the parallel path on tiny inputs).
Sourcepub fn min_items_override(self, min_items: Option<usize>) -> Self
pub fn min_items_override(self, min_items: Option<usize>) -> Self
Set minimum batch override on an existing policy.
Sourcepub fn min_total_bytes_override(self, min_bytes: Option<usize>) -> Self
pub fn min_total_bytes_override(self, min_bytes: Option<usize>) -> Self
Override minimum total bytes (Some(0) disables the byte threshold).
Sourcepub fn resolve(&self, op: ParallelOp, config: &ConfigSet) -> ParallelOptions
pub fn resolve(&self, op: ParallelOp, config: &ConfigSet) -> ParallelOptions
Resolve pool options for op using merged config and this policy.
§Panics
Panics when op is ParallelOp::IndexPack or ParallelOp::PackWrite and
pack.threads is invalid (call Self::try_resolve to surface errors).
Sourcepub fn try_resolve(
&self,
op: ParallelOp,
config: &ConfigSet,
) -> Result<ParallelOptions, ConfigError>
pub fn try_resolve( &self, op: ParallelOp, config: &ConfigSet, ) -> Result<ParallelOptions, ConfigError>
Resolve pool options, returning a config error when pack.threads is invalid.
§Errors
Returns ConfigError for rejected pack.threads values (negative integers,
booleans, or non-numeric strings), matching Git’s pack/index-pack behavior.