pub struct ThreadPool { /* private fields */ }Implementations§
Source§impl ThreadPool
impl ThreadPool
pub fn new(max_threads: usize) -> ThreadPool
Sourcepub fn default_threads() -> usize
pub fn default_threads() -> usize
Jobs are mostly blocking I/O (fetches, transport calls), so the default allows more workers than a CPU-bound pool would.
Trait Implementations§
Source§impl Clone for ThreadPool
impl Clone for ThreadPool
Source§fn clone(&self) -> ThreadPool
fn clone(&self) -> ThreadPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Executor for ThreadPool
impl Executor for ThreadPool
Source§fn spawn(
&self,
name: &'static str,
job: Box<dyn FnOnce() + Send>,
) -> Result<(), Unsupported>
fn spawn( &self, name: &'static str, job: Box<dyn FnOnce() + Send>, ) -> Result<(), Unsupported>
fn wake_at(&self, deadline: Instant, wake: WakeHandle)
Source§fn park(&self, deadline: Instant)
fn park(&self, deadline: Instant)
Block until background work may have made progress, or until
deadline. For synchronous drivers only (headless capture, tests) —
never call this on a live UI thread.fn now(&self) -> Instant
Auto Trait Implementations§
impl Forget for ThreadPool
impl Freeze for ThreadPool
impl Move for ThreadPool
impl RefUnwindSafe for ThreadPool
impl Send for ThreadPool
impl Sync for ThreadPool
impl Unpin for ThreadPool
impl UnsafeUnpin 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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more