pub struct ThreadPool { /* private fields */ }
Expand description
A thread pool that can execute tasks concurrently.
Manages a collection of worker threads and provides methods to submit tasks for execution.
§Returns
ThreadPool
- A new thread pool instance.
Implementations§
Source§impl ThreadPool
Async implementation of thread pool operations.
impl ThreadPool
Async implementation of thread pool operations.
Sourcepub fn async_execute<F>(
&self,
job: F,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: AsyncRecoverableFunction,
pub fn async_execute<F>(
&self,
job: F,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: AsyncRecoverableFunction,
Sourcepub fn async_execute_with_catch<F, E>(
&self,
job: F,
handle_error: E,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: AsyncRecoverableFunction,
E: AsyncErrorHandlerFunction,
pub fn async_execute_with_catch<F, E>(
&self,
job: F,
handle_error: E,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: AsyncRecoverableFunction,
E: AsyncErrorHandlerFunction,
Sourcepub fn async_execute_with_catch_finally<F, E, L>(
&self,
job: F,
handle_error: E,
finally: L,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>
pub fn async_execute_with_catch_finally<F, E, L>( &self, job: F, handle_error: E, finally: L, ) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>
Source§impl ThreadPool
Sync implementation of thread pool operations.
impl ThreadPool
Sync implementation of thread pool operations.
Sourcepub fn new(size: usize) -> ThreadPool
pub fn new(size: usize) -> ThreadPool
Sourcepub fn execute<F>(
&self,
job: F,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: RecoverableFunction,
pub fn execute<F>(
&self,
job: F,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: RecoverableFunction,
Sourcepub fn execute_with_catch<F, E>(
&self,
job: F,
handle_error: E,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: RecoverableFunction,
E: ErrorHandlerFunction,
pub fn execute_with_catch<F, E>(
&self,
job: F,
handle_error: E,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>where
F: RecoverableFunction,
E: ErrorHandlerFunction,
Sourcepub fn execute_with_catch_finally<F, E, L>(
&self,
job: F,
handle_error: E,
finally: L,
) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>
pub fn execute_with_catch_finally<F, E, L>( &self, job: F, handle_error: E, finally: L, ) -> Result<(), SendError<Box<dyn RecoverableFunction<Output = ()>>>>
Trait Implementations§
Auto 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> 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