pub trait BrowserProvider:
Send
+ Sync
+ 'static {
type Browser: Send + Sync + 'static;
type Page: BrowserPage + Clone;
type LaunchOptions: Default + Clone + Send + Sync + 'static;
// Required methods
fn launch<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: Self::LaunchOptions,
ctx: &'life1 LaunchContext,
) -> Pin<Box<dyn Future<Output = Result<Self::Browser, BrowserError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn new_page<'life0, 'life1, 'async_trait>(
&'life0 self,
browser: &'life1 Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<Self::Page, BrowserError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn close_page<'life0, 'async_trait>(
&'life0 self,
page: Self::Page,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn close_browser<'life0, 'async_trait>(
&'life0 self,
browser: Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
}Expand description
Concrete browser backend used by a browser pool.
This deliberately follows ADR-0006 rather than duplicating the page methods sketched in
INTERFACE §12.1. Page-level operations (goto, cookies, evaluation, and related methods) live
solely on BrowserPage. Self::Page is BrowserPage + Clone: the pool retains a concrete
clone for close bookkeeping while handing users an Arc<dyn BrowserPage>.
Required Associated Types§
Sourcetype Page: BrowserPage + Clone
type Page: BrowserPage + Clone
Provider-native page adapter used for erasure and close bookkeeping.
Required Methods§
Sourcefn launch<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: Self::LaunchOptions,
ctx: &'life1 LaunchContext,
) -> Pin<Box<dyn Future<Output = Result<Self::Browser, BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn launch<'life0, 'life1, 'async_trait>(
&'life0 self,
opts: Self::LaunchOptions,
ctx: &'life1 LaunchContext,
) -> Pin<Box<dyn Future<Output = Result<Self::Browser, BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Launches a browser and applies every field in ctx.
Sourcefn new_page<'life0, 'life1, 'async_trait>(
&'life0 self,
browser: &'life1 Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<Self::Page, BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn new_page<'life0, 'life1, 'async_trait>(
&'life0 self,
browser: &'life1 Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<Self::Page, BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Creates a new page in browser.
Sourcefn close_page<'life0, 'async_trait>(
&'life0 self,
page: Self::Page,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn close_page<'life0, 'async_trait>(
&'life0 self,
page: Self::Page,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Closes a page owned by the provider.
Sourcefn close_browser<'life0, 'async_trait>(
&'life0 self,
browser: Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn close_browser<'life0, 'async_trait>(
&'life0 self,
browser: Self::Browser,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Closes the browser and reaps its child process.
Implementations must perform close-and-wait shutdown so browser child processes cannot become zombies. Drop-based termination is only a fallback.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".