pub struct FallbackRenderer { /* private fields */ }Expand description
Composite renderer that tries multiple backends in order.
Implementations§
Source§impl FallbackRenderer
impl FallbackRenderer
pub fn new( config: &RendererConfig, user_agent: &str, proxy: Option<&str>, stealth: &StealthConfig, ) -> CrwResult<Self>
Sourcepub async fn shutdown_chrome_pool(&self, _drain: Duration)
pub async fn shutdown_chrome_pool(&self, _drain: Duration)
No-op when the cdp feature is disabled — keeps caller code simple.
Sourcepub fn with_host_limits(
self,
requests_per_second: f64,
per_host_max_concurrent: u32,
) -> Self
pub fn with_host_limits( self, requests_per_second: f64, per_host_max_concurrent: u32, ) -> Self
Configure the process-wide per-host limiter (eTLD+1 keyed). Call once
at startup with values from CrawlerConfig. Defaults: rps=0.0 (no
interval floor), per-host cap=1 (strict politeness).
Sourcepub fn preferences(&self) -> Arc<HostPreferences>
pub fn preferences(&self) -> Arc<HostPreferences>
Access the host preferences cache (for admin endpoints, tests).
Sourcepub fn breakers(&self) -> Arc<BreakerRegistry>
pub fn breakers(&self) -> Arc<BreakerRegistry>
Access the breaker registry (for tests).
Sourcepub fn js_renderer_names(&self) -> Vec<&str>
pub fn js_renderer_names(&self) -> Vec<&str>
Names of the configured JS renderers in fallback order. Used for startup logs and tests — does not leak internal types.
Sourcepub async fn fetch(
&self,
url: &str,
headers: &HashMap<String, String>,
render_js: Option<bool>,
wait_for_ms: Option<u64>,
requested_renderer: Option<&str>,
deadline: Deadline,
) -> CrwResult<FetchResult>
pub async fn fetch( &self, url: &str, headers: &HashMap<String, String>, render_js: Option<bool>, wait_for_ms: Option<u64>, requested_renderer: Option<&str>, deadline: Deadline, ) -> CrwResult<FetchResult>
Fetch a URL with smart mode: HTTP first, then JS if needed.
When render_js is None (auto-detect), the renderer also escalates to
JS rendering if the HTTP response looks like an anti-bot challenge page
(Cloudflare “Just a moment…”, etc.). The CDP renderer has built-in
challenge retry logic that waits for non-interactive JS challenges to
auto-resolve.
Sourcepub async fn check_health(&self) -> HashMap<String, bool>
pub async fn check_health(&self) -> HashMap<String, bool>
Check availability of all renderers.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FallbackRenderer
impl !UnwindSafe for FallbackRenderer
impl Freeze for FallbackRenderer
impl Send for FallbackRenderer
impl Sync for FallbackRenderer
impl Unpin for FallbackRenderer
impl UnsafeUnpin for FallbackRenderer
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
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