pub struct ThreadPoolBuilder { /* private fields */ }
Available on crate feature
multi-thread
only.Implementations§
Source§impl ThreadPoolBuilder
impl ThreadPoolBuilder
Sourcepub fn capacity(&mut self, capacity: usize) -> &mut Self
pub fn capacity(&mut self, capacity: usize) -> &mut Self
Specifies the capacity of the operation channel.
This parameter is optional.
When a new operation is incoming, but the channel is full, it will be
handled by sink according to the OverflowPolicy
that has been set.
§Panics
Panics if the value is zero.
Sourcepub fn on_thread_spawn<F>(&mut self, f: F) -> &mut Self
pub fn on_thread_spawn<F>(&mut self, f: F) -> &mut Self
Provide a function that will be called on each thread of the thread pool immediately after it is spawned. This can, for example, be used to set core affinity for each thread.
Sourcepub fn on_thread_finish<F>(&mut self, f: F) -> &mut Self
pub fn on_thread_finish<F>(&mut self, f: F) -> &mut Self
Provide a function that will be called on each thread of the thread pool just before the thread finishes.
Sourcepub fn build(&self) -> Result<ThreadPool>
pub fn build(&self) -> Result<ThreadPool>
Builds a ThreadPool
.
Auto Trait Implementations§
impl Freeze for ThreadPoolBuilder
impl !RefUnwindSafe for ThreadPoolBuilder
impl Send for ThreadPoolBuilder
impl Sync for ThreadPoolBuilder
impl Unpin for ThreadPoolBuilder
impl !UnwindSafe for ThreadPoolBuilder
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