pub struct CrawlConfig {
pub start_url: Url,
pub max_pages: usize,
pub max_time: Option<Duration>,
pub max_depth: Option<usize>,
pub request_delay: Duration,
pub concurrency: usize,
pub request_timeout: Duration,
pub user_agent: String,
pub max_redirects: usize,
pub respect_robots_txt: bool,
pub allowed_patterns: Vec<String>,
pub disallowed_patterns: Vec<String>,
}Expand description
Configuration for a crawl session.
Controls the starting URL, crawl limits, politeness settings, and
URL filtering patterns. Implements Default with sensible values
for most use cases.
§Examples
use crawlkit_engine::CrawlConfig;
use std::time::Duration;
let config = CrawlConfig {
max_pages: 500,
request_delay: Duration::from_millis(200),
concurrency: 8,
..Default::default()
};
assert_eq!(config.max_pages, 500);Fields§
§start_url: UrlThe starting URL to crawl.
max_pages: usizeMaximum number of pages to crawl.
max_time: Option<Duration>Maximum crawl duration. None means no time limit.
max_depth: Option<usize>Maximum crawl depth from the starting URL. None means no depth limit.
request_delay: DurationDelay between requests to the same domain.
concurrency: usizeNumber of concurrent fetchers per domain.
request_timeout: DurationHTTP request timeout.
user_agent: StringUser-Agent string to send with requests.
max_redirects: usizeMaximum number of redirects to follow.
respect_robots_txt: boolWhether to respect robots.txt directives.
allowed_patterns: Vec<String>Allowed URL patterns (glob-style).
disallowed_patterns: Vec<String>Disallowed URL patterns (glob-style).
Trait Implementations§
Source§impl Clone for CrawlConfig
impl Clone for CrawlConfig
Source§fn clone(&self) -> CrawlConfig
fn clone(&self) -> CrawlConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CrawlConfig
impl Debug for CrawlConfig
Source§impl Default for CrawlConfig
impl Default for CrawlConfig
Source§impl<'de> Deserialize<'de> for CrawlConfig
impl<'de> Deserialize<'de> for CrawlConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&CrawlConfig> for HttpClientConfig
impl From<&CrawlConfig> for HttpClientConfig
Source§fn from(config: &CrawlConfig) -> Self
fn from(config: &CrawlConfig) -> Self
Converts to this type from the input type.
Source§impl From<&CrawlConfig> for ScopeConfig
impl From<&CrawlConfig> for ScopeConfig
Source§fn from(config: &CrawlConfig) -> Self
fn from(config: &CrawlConfig) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for CrawlConfig
impl RefUnwindSafe for CrawlConfig
impl Send for CrawlConfig
impl Sync for CrawlConfig
impl Unpin for CrawlConfig
impl UnsafeUnpin for CrawlConfig
impl UnwindSafe for CrawlConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more