pub enum Scale {
Shutdown,
Active(usize),
Mixed {
active: usize,
max_inactive: usize,
},
NoTerm {
active: usize,
},
}Expand description
A goal for the worker pool. This describes the scale that the pool should attempt to reach.
Variants§
Shutdown
Shutdown the pool.
Active(usize)
Maintain the given number of active workers. Inactive worker threads are shutdown.
Mixed
Maintain the given number of active workers, and up to the given number of inactive workers. Any extra inactive worker threads are shutdown.
Fields
NoTerm
Maintain the given number of active workers, and an unlimited number of inactive workers. No worker threads will be terminated unless one panics.
Implementations§
Source§impl Scale
impl Scale
Sourcepub fn mixed(active: usize, max_inactive: usize) -> Scale
pub fn mixed(active: usize, max_inactive: usize) -> Scale
Scale to the given number of active workers and no more than the given number of inactive workers.
Sourcepub fn no_term(active: usize) -> Scale
pub fn no_term(active: usize) -> Scale
Scale to the given number of active workers without shutting down any inactive workers.
Sourcepub fn worker_count(self) -> usize
pub fn worker_count(self) -> usize
How many active workers should the pool scale to?
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scale
impl RefUnwindSafe for Scale
impl Send for Scale
impl Sync for Scale
impl Unpin for Scale
impl UnwindSafe for Scale
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