pub struct WorkerConfig {
pub num_workers: usize,
pub cpu_affinity: bool,
pub stack_size: Option<usize>,
pub name_prefix: String,
}Expand description
Configuration for worker threads.
Fields§
§num_workers: usizeNumber of worker threads (0 = use number of CPU cores)
cpu_affinity: boolEnable CPU core affinity (pin workers to cores)
stack_size: Option<usize>Stack size for worker threads (bytes)
name_prefix: StringWorker thread name prefix
Implementations§
Source§impl WorkerConfig
impl WorkerConfig
Sourcepub fn workers(self, n: usize) -> Self
pub fn workers(self, n: usize) -> Self
Set the number of worker threads.
Use 0 for auto-detection (number of CPU cores).
Sourcepub fn with_cpu_affinity(self) -> Self
pub fn with_cpu_affinity(self) -> Self
Enable CPU core affinity.
When enabled, workers are pinned to specific CPU cores for better cache locality.
Sourcepub fn stack_size(self, size: usize) -> Self
pub fn stack_size(self, size: usize) -> Self
Set the worker thread stack size.
Sourcepub fn name_prefix(self, prefix: impl Into<String>) -> Self
pub fn name_prefix(self, prefix: impl Into<String>) -> Self
Set the worker thread name prefix.
Sourcepub fn effective_workers(&self) -> usize
pub fn effective_workers(&self) -> usize
Get the effective number of workers.
Returns num_workers if set, otherwise returns the number of CPU cores.
Trait Implementations§
Source§impl Clone for WorkerConfig
impl Clone for WorkerConfig
Source§fn clone(&self) -> WorkerConfig
fn clone(&self) -> WorkerConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkerConfig
impl Debug for WorkerConfig
Auto Trait Implementations§
impl Freeze for WorkerConfig
impl RefUnwindSafe for WorkerConfig
impl Send for WorkerConfig
impl Sync for WorkerConfig
impl Unpin for WorkerConfig
impl UnwindSafe for WorkerConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Injectable for T
impl<T> Injectable for T
Source§fn type_id_of() -> TypeIdwhere
Self: Sized,
fn type_id_of() -> TypeIdwhere
Self: Sized,
Returns the TypeId of this type (for internal use)
Source§fn type_name_of() -> &'static strwhere
Self: Sized,
fn type_name_of() -> &'static strwhere
Self: Sized,
Returns the type name for debugging