Struct blocking_pool::Builder [−][src]
pub struct Builder { /* fields omitted */ }
A builder for a thread pool.
Examples
use blocking_pool::ThreadPool; let pool = ThreadPool::builder() .max_threads(128) .thread_name("my-app-worker-thread") .build();
Implementations
impl Builder
[src]
#[must_use]pub fn new() -> Self
[src]
Construct a new builder with its default values.
#[must_use]pub fn max_threads(self, max_threads: usize) -> Self
[src]
Set the maximum number of threads that can exist at a time in the thread pool. If all the threads are currently working and new work comes in, it will have to wait for a thread to be free in order to start.
The default value is 512, but this may change in the future.
#[must_use]pub fn thread_name<N: Into<Cow<'static, str>>>(self, name: N) -> Self
[src]
Set the name that the spawned threads have.
The default value is blocking-worker
, but this may change in the future.
#[must_use]pub fn thread_stack_size(self, stack_size: usize) -> Self
[src]
Set the stack size of each spawned worker thread.
If unset, currently it will use the RUST_MIN_STACK
environment variable or default to 2
MiB if that is not present, but this behaviour may change in the future.
#[must_use]pub fn idle_timeout(self, idle_timeout: Duration) -> Self
[src]
Set the duration a worker thread waits for without any work to perform before exiting.
The default value is 10 seconds, but this may change in the future.
#[must_use]pub fn build(self) -> ThreadPool
[src]
Consume this builder and return the newly created thread pool.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,