pub struct KeyedWorkerPool<K: WorkerKey, W: KeyedWorker<K>, F: KeyedWorkerFactory<K, W>> { /* private fields */ }Implementations§
Source§impl<K: WorkerKey, W: KeyedWorker<K>, F: KeyedWorkerFactory<K, W>> KeyedWorkerPool<K, W, F>
impl<K: WorkerKey, W: KeyedWorker<K>, F: KeyedWorkerFactory<K, W>> KeyedWorkerPool<K, W, F>
Sourcepub fn new(
factory: F,
config: KeyedWorkerPoolConfig,
) -> KeyedWorkerPoolRef<K, W, F>
pub fn new( factory: F, config: KeyedWorkerPoolConfig, ) -> KeyedWorkerPoolRef<K, W, F>
Creates a keyed worker pool with explicit configuration.
A finite max_count is a target rather than a strict upper bound. When the
pool is full, no idle worker can be replaced, and a requested key
has no created or pending worker, the pool may temporarily exceed the target.
Excess workers are removed when they are returned and are not needed by a
waiter. None leaves the pool-wide worker count unlimited.
pub fn cleanup_idle_worker(&self) -> usize
pub async fn get_worker( self: &KeyedWorkerPoolRef<K, W, F>, key: K, ) -> PoolResult<KeyedWorkerGuard<K, W, F>>
pub async fn clear_all_worker(&self)
Auto Trait Implementations§
impl<K, W, F> !Freeze for KeyedWorkerPool<K, W, F>
impl<K, W, F> RefUnwindSafe for KeyedWorkerPool<K, W, F>where
F: RefUnwindSafe,
impl<K, W, F> Send for KeyedWorkerPool<K, W, F>
impl<K, W, F> Sync for KeyedWorkerPool<K, W, F>
impl<K, W, F> Unpin for KeyedWorkerPool<K, W, F>
impl<K, W, F> UnsafeUnpin for KeyedWorkerPool<K, W, F>
impl<K, W, F> UnwindSafe for KeyedWorkerPool<K, W, F>where
F: RefUnwindSafe,
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