Skip to main content

Downloader

Trait Downloader 

Source
pub trait Downloader:
    Send
    + Sync
    + 'static {
    type Client: Send + Sync;

    // Required methods
    fn download<'life0, 'async_trait>(
        &'life0 self,
        request: Request,
    ) -> Pin<Box<dyn Future<Output = Result<Response, SpiderError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn client(&self) -> &Self::Client;
}
Expand description

A trait for HTTP downloaders that can fetch web pages and apply middleware

Required Associated Types§

Source

type Client: Send + Sync

Concrete HTTP client type used by the downloader.

Required Methods§

Source

fn download<'life0, 'async_trait>( &'life0 self, request: Request, ) -> Pin<Box<dyn Future<Output = Result<Response, SpiderError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Download a web page using the provided request. This function focuses solely on executing the HTTP request.

§Errors

Returns an error when request execution fails.

Source

fn client(&self) -> &Self::Client

Returns a reference to the underlying HTTP client.

Implementors§