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.