pub struct TaskPool { /* private fields */ }Expand description
Controls a set of background threads that execute work from a provider.
Implementations§
Source§impl TaskPool
impl TaskPool
Sourcepub fn new(provider: impl WorkProvider, threads: usize) -> Self
pub fn new(provider: impl WorkProvider, threads: usize) -> Self
Creates a new pool that draws work from the given provider, with the specified number of background threads.
Sourcepub fn with_spawner(
provider: impl WorkProvider,
threads: usize,
spawner: impl FnMut(usize, Box<dyn FnOnce() + Send + 'static>),
) -> Self
pub fn with_spawner( provider: impl WorkProvider, threads: usize, spawner: impl FnMut(usize, Box<dyn FnOnce() + Send + 'static>), ) -> Self
Creates a new pool that draws work from the given provider, with the specified number of background threads. The custom spawning function is invoked to create each thread.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskPool
impl !RefUnwindSafe for TaskPool
impl Send for TaskPool
impl Sync for TaskPool
impl Unpin for TaskPool
impl !UnwindSafe for TaskPool
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