pub struct ThreadPool { /* private fields */ }
Implementations§
source§impl ThreadPool
impl ThreadPool
pub fn new() -> Result<Self>
pub fn with_workers(num_workers: usize) -> Result<Self>
pub fn builder() -> Builder
sourcepub fn stack_size(&self) -> Option<usize>
pub fn stack_size(&self) -> Option<usize>
Returns the size of the stack of the worker threads.
sourcepub fn worker_count(&self) -> usize
pub fn worker_count(&self) -> usize
Returns the number of active worker threads.
sourcepub fn max_workers_count(&self) -> Option<usize>
pub fn max_workers_count(&self) -> Option<usize>
Returns the max allowed number of workers
sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Returns the number of tasks that still running.
sourcepub fn panicked_count(&self) -> usize
pub fn panicked_count(&self) -> usize
Returns the number of workers that panicked.
sourcepub fn execute<F: FnOnce() + Send + 'static>(&self, f: F) -> Result<()>
pub fn execute<F: FnOnce() + Send + 'static>(&self, f: F) -> Result<()>
Executes the given task on an available worker.
pub fn join(&self)
Trait Implementations§
source§impl Clone for ThreadPool
impl Clone for ThreadPool
source§fn clone(&self) -> ThreadPool
fn clone(&self) -> ThreadPool
Returns a copy 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 moreAuto Trait Implementations§
impl Freeze for ThreadPool
impl RefUnwindSafe for ThreadPool
impl Send for ThreadPool
impl Sync for ThreadPool
impl Unpin for ThreadPool
impl UnwindSafe for ThreadPool
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)