pub struct JsRenderDecisionEngine { /* private fields */ }Expand description
Decision engine for whether to use JavaScript rendering.
Analyzes URL patterns and HTML hints to decide if a page needs Playwright rendering. Checks skip/force patterns first, then SPA framework indicators.
§Examples
use crawlkit_engine::JsRenderDecisionEngine;
use crawlkit_engine::JsRenderDecision;
let engine = JsRenderDecisionEngine::new();
let decision = engine.should_render_js("https://example.com/page", None);
assert!(matches!(decision, JsRenderDecision::Skip { .. }));Implementations§
Source§impl JsRenderDecisionEngine
impl JsRenderDecisionEngine
Sourcepub fn add_force_js_pattern(&mut self, pattern: String)
pub fn add_force_js_pattern(&mut self, pattern: String)
Add URL pattern that forces JS rendering.
Sourcepub fn add_skip_js_pattern(&mut self, pattern: String)
pub fn add_skip_js_pattern(&mut self, pattern: String)
Add URL pattern that skips JS rendering.
Sourcepub fn should_render_js(
&self,
url: &str,
html_hint: Option<&str>,
) -> JsRenderDecision
pub fn should_render_js( &self, url: &str, html_hint: Option<&str>, ) -> JsRenderDecision
Decide if a URL needs JavaScript rendering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JsRenderDecisionEngine
impl RefUnwindSafe for JsRenderDecisionEngine
impl Send for JsRenderDecisionEngine
impl Sync for JsRenderDecisionEngine
impl Unpin for JsRenderDecisionEngine
impl UnsafeUnpin for JsRenderDecisionEngine
impl UnwindSafe for JsRenderDecisionEngine
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