pub struct PlaywrightRenderer { /* private fields */ }Expand description
Playwright renderer with browser context isolation.
Manages browser contexts with resource limits (memory, CPU) and provides page rendering via Playwright CLI subprocess. Each render creates an isolated browser context that is destroyed after use.
§Examples
use crawlkit_engine::{PlaywrightRenderer, PlaywrightConfig};
let renderer = PlaywrightRenderer::new(PlaywrightConfig::default());
assert!(!renderer.is_available()); // disabled by defaultImplementations§
Source§impl PlaywrightRenderer
impl PlaywrightRenderer
Sourcepub fn new(config: PlaywrightConfig) -> Self
pub fn new(config: PlaywrightConfig) -> Self
Create a new Playwright renderer.
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create with default config.
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Check if Playwright is available.
Sourcepub fn detector(&self) -> &PlaywrightDetector
pub fn detector(&self) -> &PlaywrightDetector
Get detector reference.
Sourcepub fn create_context(&self) -> Result<BrowserContext, PlaywrightError>
pub fn create_context(&self) -> Result<BrowserContext, PlaywrightError>
Create a new browser context with resource isolation.
§Errors
Returns error if context creation fails.
Sourcepub async fn render(&self, url: &str) -> Result<RenderedPage, PlaywrightError>
pub async fn render(&self, url: &str) -> Result<RenderedPage, PlaywrightError>
Sourcepub fn active_contexts(&self) -> usize
pub fn active_contexts(&self) -> usize
Get active context count.
Sourcepub fn config(&self) -> &PlaywrightConfig
pub fn config(&self) -> &PlaywrightConfig
Get configuration.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PlaywrightRenderer
impl !UnwindSafe for PlaywrightRenderer
impl Freeze for PlaywrightRenderer
impl Send for PlaywrightRenderer
impl Sync for PlaywrightRenderer
impl Unpin for PlaywrightRenderer
impl UnsafeUnpin for PlaywrightRenderer
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
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>
Converts
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>
Converts
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