pub struct BrowserPool { /* private fields */ }Expand description
A shared pool managing a single browser process with tab concurrency control.
The browser is lazily launched on the first acquire_browser() call.
A semaphore limits the number of concurrent tabs to prevent memory exhaustion.
Implementations§
Source§impl BrowserPool
impl BrowserPool
Sourcepub fn new(config: BrowserPoolConfig) -> Self
pub fn new(config: BrowserPoolConfig) -> Self
Creates a new browser pool with the given configuration.
Sourcepub fn available_tab_permits(&self) -> usize
pub fn available_tab_permits(&self) -> usize
Returns the number of tabs that may be opened immediately.
Sourcepub async fn warm_up(&self) -> UseResult<()>
pub async fn warm_up(&self) -> UseResult<()>
Starts the configured provider without exposing its implementation handle.
Sourcepub async fn shutdown(&self)
pub async fn shutdown(&self)
Shuts down the browser and reaps its spawned child process.
Runtime ownership is detached into a cleanup task before this method
awaits process termination. If the caller itself is cancelled, cleanup
therefore continues instead of dropping Chrome’s parent and orphaning
its renderer processes. Callers should release every Arc<Browser>
returned by Self::acquire_browser first. If a shared handle remains,
shutdown can request CDP close but final reaping is deferred until the
last external handle is dropped.
Trait Implementations§
Source§impl PageRenderer for BrowserPool
impl PageRenderer for BrowserPool
fn render<'life0, 'async_trait>(
&'life0 self,
request: RenderRequest,
) -> Pin<Box<dyn Future<Output = UseResult<RenderedPage>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl !Freeze for BrowserPool
impl !RefUnwindSafe for BrowserPool
impl !UnwindSafe for BrowserPool
impl Send for BrowserPool
impl Sync for BrowserPool
impl Unpin for BrowserPool
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more