pub struct ThreadPool<Shared: 'static + Clone + Send> { /* private fields */ }
Expand description
A fast thread pool (never pay the cost of thread spawn.)
Implementations§
Sourcepub fn start(config: ThreadPoolConfig, shared: Shared) -> Self
pub fn start(config: ThreadPoolConfig, shared: Shared) -> Self
Start a thread pool
This function spawn min_workers
threads.
Sourcepub fn async_handler(&self) -> ThreadPoolAsyncHandler<Shared>
pub fn async_handler(&self) -> ThreadPoolAsyncHandler<Shared>
Get an asynchronous handler
Sourcepub fn sync_handler(&self) -> ThreadPoolSyncHandler<Shared>
pub fn sync_handler(&self) -> ThreadPoolSyncHandler<Shared>
Get a synchronous handler
Sourcepub fn into_async_handler(self) -> ThreadPoolAsyncHandler<Shared>
pub fn into_async_handler(self) -> ThreadPoolAsyncHandler<Shared>
Convert threadpool into an asynchronous handler
Sourcepub fn into_sync_handler(self) -> ThreadPoolSyncHandler<Shared>
pub fn into_sync_handler(self) -> ThreadPoolSyncHandler<Shared>
Convert threadpool into a synchronous handler
Trait Implementations§
Auto Trait Implementations§
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