pub struct PoolManager { /* private fields */ }Expand description
Manages a pool of browser contexts with concurrency limits.
Implementations§
Source§impl PoolManager
impl PoolManager
Sourcepub fn new(renderer: Arc<dyn Renderer>, max_contexts: usize) -> Self
pub fn new(renderer: Arc<dyn Renderer>, max_contexts: usize) -> Self
Create a new pool manager.
Sourcepub async fn acquire(&self) -> Result<ContextHandle>
pub async fn acquire(&self) -> Result<ContextHandle>
Acquire a browser context from the pool.
Blocks if the maximum number of concurrent contexts is reached.
Sourcepub async fn release(&self, handle: ContextHandle) -> Result<()>
pub async fn release(&self, handle: ContextHandle) -> Result<()>
Return a context to the pool (closes it).
Sourcepub fn max_contexts(&self) -> usize
pub fn max_contexts(&self) -> usize
Maximum allowed concurrent contexts.
Auto Trait Implementations§
impl Freeze for PoolManager
impl !RefUnwindSafe for PoolManager
impl Send for PoolManager
impl Sync for PoolManager
impl Unpin for PoolManager
impl UnsafeUnpin for PoolManager
impl !UnwindSafe for PoolManager
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