pub struct CrawlSource<F: Fetcher> { /* private fields */ }Expand description
A recursive HTTP crawler over a Fetcher.
Implementations§
Source§impl<F: Fetcher> CrawlSource<F>
impl<F: Fetcher> CrawlSource<F>
Sourcepub fn with_config(fetcher: F, config: CrawlConfig) -> Self
pub fn with_config(fetcher: F, config: CrawlConfig) -> Self
Create with explicit configuration.
Sourcepub fn scope(self, scope: CrawlScope) -> Self
pub fn scope(self, scope: CrawlScope) -> Self
Set the crawl scope.
Sourcepub fn concurrency(self, concurrency: usize) -> Self
pub fn concurrency(self, concurrency: usize) -> Self
Set the maximum number of fetches in flight at once (clamped to ≥ 1).
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set the per-page retry budget for retriable errors.
Sourcepub fn respect_robots(self, respect: bool) -> Self
pub fn respect_robots(self, respect: bool) -> Self
Fetch and honor robots.txt per host (opt-in).
Sourcepub fn require_path(self, substring: impl Into<CompactString>) -> Self
pub fn require_path(self, substring: impl Into<CompactString>) -> Self
Require that every followed link’s URL path contains substring (additive;
all required substrings must be present). Confines the crawl to a sub-path.
Sourcepub fn accept_extension(self, extension: impl AsRef<str>) -> Self
pub fn accept_extension(self, extension: impl AsRef<str>) -> Self
Only index pages whose URL path ends with extension (additive). Other
pages are still crawled for links.
Sourcepub fn index_path(self, substring: impl Into<CompactString>) -> Self
pub fn index_path(self, substring: impl Into<CompactString>) -> Self
Only index pages whose URL path contains substring (additive). Other pages
are still crawled for links — this narrows indexing, not crawling.
Sourcepub fn validators(
self,
entries: impl IntoIterator<Item = (UrlKey, CompactString)>,
) -> Self
pub fn validators( self, entries: impl IntoIterator<Item = (UrlKey, CompactString)>, ) -> Self
Provide known validators (If-None-Match) for conditional re-crawls.
Sourcepub fn known_edges(
self,
entries: impl IntoIterator<Item = (UrlKey, Vec<Url>)>,
) -> Self
pub fn known_edges( self, entries: impl IntoIterator<Item = (UrlKey, Vec<Url>)>, ) -> Self
Provide previously indexed outbound links so 304 pages keep feeding the frontier.
Sourcepub fn failed_count(&self) -> u32
pub fn failed_count(&self) -> u32
Child pages that failed after retries during the most recent crawl.
Sourcepub fn take_revalidated(&self) -> Vec<Url>
pub fn take_revalidated(&self) -> Vec<Url>
Drain the pages revalidated as unchanged (HTTP 304) during the most
recent crawl. They transferred no body and yielded no Page, so this
is the only place their revalidation is visible — a freshness tracker
consumes it to record “checked, unchanged” against each URL.
Sourcepub fn config(&self) -> &CrawlConfig
pub fn config(&self) -> &CrawlConfig
Read-only view of the configuration.
Trait Implementations§
Auto Trait Implementations§
impl<F> !Freeze for CrawlSource<F>
impl<F> RefUnwindSafe for CrawlSource<F>where
F: RefUnwindSafe,
impl<F> Send for CrawlSource<F>
impl<F> Sync for CrawlSource<F>
impl<F> Unpin for CrawlSource<F>where
F: Unpin,
impl<F> UnsafeUnpin for CrawlSource<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for CrawlSource<F>where
F: UnwindSafe,
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
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> ⓘ
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