pub struct ThreadPoolConfig {
pub num_threads: Option<usize>,
pub thread_name_prefix: Option<String>,
pub stack_size: Option<usize>,
pub max_pending_tasks: Option<usize>,
pub enable_work_stealing: bool,
}Expand description
Thread pool configuration
Fields§
§num_threads: Option<usize>Number of worker threads (None = number of CPUs)
thread_name_prefix: Option<String>Thread name prefix
stack_size: Option<usize>Stack size per thread
max_pending_tasks: Option<usize>Maximum pending tasks (None = unbounded)
enable_work_stealing: boolEnable work stealing (rayon-based)
Implementations§
Source§impl ThreadPoolConfig
impl ThreadPoolConfig
Sourcepub fn num_threads(self, n: usize) -> Self
pub fn num_threads(self, n: usize) -> Self
Set the number of worker threads
Sourcepub fn thread_name_prefix(self, prefix: impl Into<String>) -> Self
pub fn thread_name_prefix(self, prefix: impl Into<String>) -> Self
Set the thread name prefix
Sourcepub fn stack_size(self, size: usize) -> Self
pub fn stack_size(self, size: usize) -> Self
Set the stack size per thread
Sourcepub fn max_pending_tasks(self, max: usize) -> Self
pub fn max_pending_tasks(self, max: usize) -> Self
Set the maximum pending tasks
Sourcepub fn enable_work_stealing(self, enabled: bool) -> Self
pub fn enable_work_stealing(self, enabled: bool) -> Self
Enable or disable work stealing
Trait Implementations§
Source§impl Clone for ThreadPoolConfig
impl Clone for ThreadPoolConfig
Source§fn clone(&self) -> ThreadPoolConfig
fn clone(&self) -> ThreadPoolConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ThreadPoolConfig
impl Debug for ThreadPoolConfig
Auto Trait Implementations§
impl Freeze for ThreadPoolConfig
impl RefUnwindSafe for ThreadPoolConfig
impl Send for ThreadPoolConfig
impl Sync for ThreadPoolConfig
impl Unpin for ThreadPoolConfig
impl UnsafeUnpin for ThreadPoolConfig
impl UnwindSafe for ThreadPoolConfig
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more