pub struct EnqueueLinker { /* private fields */ }Expand description
Enqueues child URLs through a running crawler.
§Examples
use millipede_core::prelude::*;
use url::Url;
let enqueue = EnqueueLinker::new(ctx.crawler.clone(), &ctx.request);
let result = enqueue
.urls([Url::parse("https://example.com/child")?])
.await?;
assert_eq!(result.added.len() + result.skipped.len(), 1);Implementations§
Source§impl EnqueueLinker
impl EnqueueLinker
Sourcepub fn new(crawler: CrawlerHandle, parent: &Request) -> Self
pub fn new(crawler: CrawlerHandle, parent: &Request) -> Self
Creates a linker from the current crawler handle and parent request.
Sourcepub fn with_extractor(
crawler: CrawlerHandle,
parent: &Request,
extractor: Arc<dyn LinkExtractor>,
) -> Self
pub fn with_extractor( crawler: CrawlerHandle, parent: &Request, extractor: Arc<dyn LinkExtractor>, ) -> Self
Creates a linker with an HTML-aware link extractor.
Sourcepub fn options(&self) -> EnqueueLinksOptions<'_>
pub fn options(&self) -> EnqueueLinksOptions<'_>
Starts configuring an enqueue operation.
Sourcepub async fn urls(
&self,
urls: impl IntoIterator<Item = Url>,
) -> Result<EnqueueResult, CrawlError>
pub async fn urls( &self, urls: impl IntoIterator<Item = Url>, ) -> Result<EnqueueResult, CrawlError>
Enqueues explicit absolute URLs using default options.
Explicit URLs bypass EnqueueStrategy relationship filtering. Strategies constrain DOM
discovery; callers that already selected concrete URLs retain the URLs-only behavior that
predates extractor support.
Sourcepub async fn all(&self) -> Result<EnqueueResult, CrawlError>
pub async fn all(&self) -> Result<EnqueueResult, CrawlError>
Extracts links with the default selector and allows every HTTP(S) URL.
Sourcepub async fn same_origin(&self) -> Result<EnqueueResult, CrawlError>
pub async fn same_origin(&self) -> Result<EnqueueResult, CrawlError>
Extracts links with the default selector and keeps the parent’s origin.
Sourcepub async fn same_hostname(&self) -> Result<EnqueueResult, CrawlError>
pub async fn same_hostname(&self) -> Result<EnqueueResult, CrawlError>
Extracts links with the default selector and keeps the parent’s hostname.
Sourcepub async fn same_domain(&self) -> Result<EnqueueResult, CrawlError>
pub async fn same_domain(&self) -> Result<EnqueueResult, CrawlError>
Extracts links with the default selector and keeps the parent’s registrable domain.
Trait Implementations§
Source§impl Clone for EnqueueLinker
impl Clone for EnqueueLinker
Source§fn clone(&self) -> EnqueueLinker
fn clone(&self) -> EnqueueLinker
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more