pub struct RobotsPolicy {
pub fetched_at_ms: u64,
pub expires_at_ms: u64,
pub fetch_status: FetchStatus,
pub groups: Vec<Group>,
pub sitemaps: Vec<String>,
pub content_size: usize,
pub etag: Option<String>,
pub last_modified: Option<String>,
}Expand description
Complete robots.txt policy
Fields§
§fetched_at_ms: u64When the robots.txt was fetched (Unix timestamp millis)
expires_at_ms: u64When this policy expires (Unix timestamp millis)
fetch_status: FetchStatusFetch status
groups: Vec<Group>Parsed groups
sitemaps: Vec<String>Sitemap URLs found
content_size: usizeOriginal robots.txt size in bytes
etag: Option<String>ETag header for conditional GET
last_modified: Option<String>Last-Modified header for conditional GET
Implementations§
Source§impl RobotsPolicy
impl RobotsPolicy
Create a policy for unavailable robots.txt (allow all)
Sourcepub fn unreachable(reason: String, ttl: Duration) -> Self
pub fn unreachable(reason: String, ttl: Duration) -> Self
Create a policy for unreachable robots.txt (deny all)
Sourcepub fn protected(status_code: u16, ttl: Duration) -> Self
pub fn protected(status_code: u16, ttl: Duration) -> Self
Create a policy for protected robots.txt (deny all in safe mode)
Sourcepub fn not_modified(ttl: Duration) -> Self
pub fn not_modified(ttl: Duration) -> Self
Create a policy indicating 304 Not Modified The caller should extend the existing cached policy’s TTL
Sourcepub fn extend_ttl(&mut self, ttl: Duration)
pub fn extend_ttl(&mut self, ttl: Duration)
Extend the expiration time by the given TTL
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this policy has expired
Trait Implementations§
Source§impl Clone for RobotsPolicy
impl Clone for RobotsPolicy
Source§fn clone(&self) -> RobotsPolicy
fn clone(&self) -> RobotsPolicy
Returns a duplicate of the value. Read more
1.0.0 · 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 RobotsPolicy
impl Debug for RobotsPolicy
Source§impl<'de> Deserialize<'de> for RobotsPolicy
impl<'de> Deserialize<'de> for RobotsPolicy
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
Auto Trait Implementations§
impl Freeze for RobotsPolicy
impl RefUnwindSafe for RobotsPolicy
impl Send for RobotsPolicy
impl Sync for RobotsPolicy
impl Unpin for RobotsPolicy
impl UnwindSafe for RobotsPolicy
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