pub struct WorkerPool { /* private fields */ }Expand description
Limits concurrent handler tasks for a subscription.
Implementations§
Source§impl WorkerPool
impl WorkerPool
Sourcepub fn new(max_concurrent: usize) -> Self
pub fn new(max_concurrent: usize) -> Self
Create a pool with at most max_concurrent in-flight handlers.
Sourcepub async fn acquire(&self) -> Result<OwnedSemaphorePermit>
pub async fn acquire(&self) -> Result<OwnedSemaphorePermit>
Acquire a permit before running a handler task.
§Errors
Returns PhotonError::Internal if the semaphore has been closed.
Auto Trait Implementations§
impl Freeze for WorkerPool
impl RefUnwindSafe for WorkerPool
impl Send for WorkerPool
impl Sync for WorkerPool
impl Unpin for WorkerPool
impl UnsafeUnpin for WorkerPool
impl UnwindSafe for WorkerPool
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