Skip to main content

LinkExtractor

Trait LinkExtractor 

Source
pub trait LinkExtractor: Send + Sync {
    // Required method
    fn extract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        selector: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtractedLink>, CrawlError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Extracts links from a static document or live browser page.

Passing None selects the implementation’s default selector, normally a[href]. Extraction is asynchronous because a DOM-level browser extractor evaluates JavaScript against a live page over CDP (millipede-browser, Phase 6), while static-document extractors such as millipede-html simply have no await points. The trait remains object-safe so crawler implementations can erase their extractor.

Required Methods§

Source

fn extract<'life0, 'life1, 'async_trait>( &'life0 self, selector: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtractedLink>, CrawlError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Extracts raw links selected by selector or the implementation default.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§