pub struct FixedThreadPoolBuilder { /* private fields */ }Expand description
Builder for FixedThreadPool.
The fixed pool prestarts exactly pool_size workers and never changes that
count during runtime.
Implementations§
Source§impl FixedThreadPoolBuilder
impl FixedThreadPoolBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a builder with CPU parallelism defaults.
§Returns
A builder with a fixed worker count equal to available parallelism.
Sourcepub fn queue_capacity(self, capacity: usize) -> Self
pub fn queue_capacity(self, capacity: usize) -> Self
Sourcepub fn unbounded_queue(self) -> Self
pub fn unbounded_queue(self) -> Self
Sourcepub fn thread_name_prefix(self, prefix: &str) -> Self
pub fn thread_name_prefix(self, prefix: &str) -> Self
Sourcepub fn stack_size(self, stack_size: usize) -> Self
pub fn stack_size(self, stack_size: usize) -> Self
Sourcepub fn build(self) -> Result<FixedThreadPool, ThreadPoolBuildError>
pub fn build(self) -> Result<FixedThreadPool, ThreadPoolBuildError>
Builds the configured fixed thread pool.
§Returns
A fixed pool with all workers prestarted.
§Errors
Returns ThreadPoolBuildError when configuration is invalid or a
worker thread cannot be spawned.
Trait Implementations§
Source§impl Clone for FixedThreadPoolBuilder
impl Clone for FixedThreadPoolBuilder
Source§fn clone(&self) -> FixedThreadPoolBuilder
fn clone(&self) -> FixedThreadPoolBuilder
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 FixedThreadPoolBuilder
impl Debug for FixedThreadPoolBuilder
Auto Trait Implementations§
impl Freeze for FixedThreadPoolBuilder
impl RefUnwindSafe for FixedThreadPoolBuilder
impl Send for FixedThreadPoolBuilder
impl Sync for FixedThreadPoolBuilder
impl Unpin for FixedThreadPoolBuilder
impl UnsafeUnpin for FixedThreadPoolBuilder
impl UnwindSafe for FixedThreadPoolBuilder
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