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§
Required Methods§
Sourcefn 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 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.