pub struct BrowserPool { /* private fields */ }Expand description
Headless browser pool for concurrent rendering
Implementations§
Source§impl BrowserPool
impl BrowserPool
Sourcepub fn new(backend_type: BrowserBackendType, max_concurrent: usize) -> Self
pub fn new(backend_type: BrowserBackendType, max_concurrent: usize) -> Self
Create a new browser pool
Sourcepub fn with_options(self, options: RenderOptions) -> Self
pub fn with_options(self, options: RenderOptions) -> Self
Configure default options
Sourcepub fn backend_type(&self) -> &BrowserBackendType
pub fn backend_type(&self) -> &BrowserBackendType
Get the backend type
Sourcepub fn max_concurrent(&self) -> usize
pub fn max_concurrent(&self) -> usize
Get max concurrent browsers
Sourcepub fn has_available_slot(&self) -> bool
pub fn has_available_slot(&self) -> bool
Check if a browser slot is available
Sourcepub fn acquire(&self) -> Option<BrowserSlot<'_>>
pub fn acquire(&self) -> Option<BrowserSlot<'_>>
Acquire a browser slot
Sourcepub async fn render(
&self,
url: &Url,
options: Option<&RenderOptions>,
) -> Result<BrowserResponse>
pub async fn render( &self, url: &Url, options: Option<&RenderOptions>, ) -> Result<BrowserResponse>
Render a URL using the pool
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Active browser count
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BrowserPool
impl RefUnwindSafe for BrowserPool
impl Send for BrowserPool
impl Sync for BrowserPool
impl Unpin 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