pub struct BrowserPool { /* private fields */ }Expand description
A pool of browser sessions — the roster of active ring-side scouts.
Manages concurrent browser sessions with an upper bound, backed by
DashMap for lock-free concurrent access.
Implementations§
Source§impl BrowserPool
impl BrowserPool
Sourcepub fn new(config: BrowserConfig, max_sessions: usize) -> Self
pub fn new(config: BrowserConfig, max_sessions: usize) -> Self
Create a new browser pool with the given config and session limit.
Sourcepub fn get_session(&self, id: &Uuid) -> Option<BrowserSession>
pub fn get_session(&self, id: &Uuid) -> Option<BrowserSession>
Retrieve a clone of a session by its ID.
Sourcepub fn active_sessions(&self) -> Vec<BrowserSession>
pub fn active_sessions(&self) -> Vec<BrowserSession>
List all active sessions.
Sourcepub fn session_count(&self) -> usize
pub fn session_count(&self) -> usize
Return the number of active sessions.
Sourcepub fn create_session(&self) -> PunchResult<BrowserSession>
pub fn create_session(&self) -> PunchResult<BrowserSession>
Create a new session and add it to the pool.
Returns an error if the pool is at capacity — no room in the ring.
Sourcepub fn close_session(&self, id: &Uuid) -> PunchResult<()>
pub fn close_session(&self, id: &Uuid) -> PunchResult<()>
Close and remove a session from the pool.
Sourcepub fn config(&self) -> &BrowserConfig
pub fn config(&self) -> &BrowserConfig
Get a reference to the pool’s browser configuration.
Auto Trait Implementations§
impl Freeze for BrowserPool
impl !RefUnwindSafe for BrowserPool
impl Send for BrowserPool
impl Sync for BrowserPool
impl Unpin for BrowserPool
impl UnsafeUnpin for BrowserPool
impl UnwindSafe for BrowserPool
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