pub struct RobotsTxtMiddleware { /* private fields */ }Expand description
robots.txt enforcement middleware.
Middleware that enforces robots.txt rules before download.
Implementations§
Source§impl RobotsTxtMiddleware
impl RobotsTxtMiddleware
Sourcepub fn new() -> RobotsTxtMiddleware
pub fn new() -> RobotsTxtMiddleware
Creates a new RobotsTxtMiddleware with default settings.
Sourcepub fn cache_ttl(self, cache_ttl: Duration) -> RobotsTxtMiddleware
pub fn cache_ttl(self, cache_ttl: Duration) -> RobotsTxtMiddleware
Set the time-to-live for the cache.
Sourcepub fn cache_capacity(self, cache_capacity: u64) -> RobotsTxtMiddleware
pub fn cache_capacity(self, cache_capacity: u64) -> RobotsTxtMiddleware
Set the max capacity for the cache.
Sourcepub fn request_timeout(self, request_timeout: Duration) -> RobotsTxtMiddleware
pub fn request_timeout(self, request_timeout: Duration) -> RobotsTxtMiddleware
Set the timeout for fetching robots.txt files.
Trait Implementations§
Source§impl Debug for RobotsTxtMiddleware
impl Debug for RobotsTxtMiddleware
Source§impl Default for RobotsTxtMiddleware
impl Default for RobotsTxtMiddleware
Source§fn default() -> RobotsTxtMiddleware
fn default() -> RobotsTxtMiddleware
Returns the “default value” for a type. Read more
Source§impl<C> Middleware<C> for RobotsTxtMiddlewarewhere
C: HttpClient,
impl<C> Middleware<C> for RobotsTxtMiddlewarewhere
C: HttpClient,
Source§fn process_request<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 C,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RobotsTxtMiddleware: 'async_trait,
fn process_request<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 C,
request: Request,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
RobotsTxtMiddleware: 'async_trait,
Intercepts an outgoing request before the downloader runs. Read more
Source§fn process_response<'life0, 'async_trait>(
&'life0 self,
response: Response,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Response>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn process_response<'life0, 'async_trait>(
&'life0 self,
response: Response,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Response>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Intercepts a successful response after download. Read more
Source§fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 Request,
error: &'life2 SpiderError,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
fn handle_error<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_request: &'life1 Request,
error: &'life2 SpiderError,
) -> Pin<Box<dyn Future<Output = Result<MiddlewareAction<Request>, SpiderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Handles downloader errors for a request. Read more
Auto Trait Implementations§
impl Freeze for RobotsTxtMiddleware
impl !RefUnwindSafe for RobotsTxtMiddleware
impl Send for RobotsTxtMiddleware
impl Sync for RobotsTxtMiddleware
impl Unpin for RobotsTxtMiddleware
impl !UnwindSafe for RobotsTxtMiddleware
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
Mutably borrows from an owned value. Read more