Struct robotstxt::matcher::RobotsMatcher [−][src]
RobotsMatcher - matches robots.txt against URLs.
The Matcher uses a default match strategy for Allow/Disallow patterns which is the official way of Google crawler to match robots.txt. It is also possible to provide a custom match strategy.
The entry point for the user is to call one of the allowed_by_robots methods that return directly if a URL is being allowed according to the robots.txt and the crawl agent. The RobotsMatcher can be re-used for URLs/robots.txt but is not thread-safe.
Implementations
impl<'a, S: RobotsMatchStrategy> RobotsMatcher<'a, S>
[src]
pub fn allowed_by_robots(
&mut self,
robots_body: &'a str,
user_agents: Vec<&'a str>,
url: &'a str
) -> bool where
Self: RobotsParseHandler,
[src]
&mut self,
robots_body: &'a str,
user_agents: Vec<&'a str>,
url: &'a str
) -> bool where
Self: RobotsParseHandler,
Returns true if 'url' is allowed to be fetched by any member of the "user_agents" vector. 'url' must be %-encoded according to RFC3986.
pub fn one_agent_allowed_by_robots(
&mut self,
robots_txt: &'a str,
user_agent: &'a str,
url: &'a str
) -> bool where
Self: RobotsParseHandler,
[src]
&mut self,
robots_txt: &'a str,
user_agent: &'a str,
url: &'a str
) -> bool where
Self: RobotsParseHandler,
Do robots check for 'url' when there is only one user agent. 'url' must be %-encoded according to RFC3986.
pub fn is_valid_user_agent_to_obey(user_agent: &str) -> bool
[src]
Verifies that the given user agent is valid to be matched against robots.txt. Valid user agent strings only contain the characters [a-zA-Z_-].
Trait Implementations
impl<'a, S: Default + RobotsMatchStrategy> Default for RobotsMatcher<'a, S>
[src]
fn default() -> RobotsMatcher<'a, S>
[src]
impl<S: RobotsMatchStrategy> RobotsParseHandler for RobotsMatcher<'_, S>
[src]
fn handle_robots_start(&mut self)
[src]
fn handle_robots_end(&mut self)
[src]
fn handle_user_agent(&mut self, line_num: u32, user_agent: &str)
[src]
fn handle_allow(&mut self, line_num: u32, value: &str)
[src]
fn handle_disallow(&mut self, line_num: u32, value: &str)
[src]
fn handle_sitemap(&mut self, line_num: u32, value: &str)
[src]
fn handle_unknown_action(&mut self, line_num: u32, action: &str, value: &str)
[src]
Auto Trait Implementations
impl<'a, S> RefUnwindSafe for RobotsMatcher<'a, S> where
S: RefUnwindSafe,
[src]
S: RefUnwindSafe,
impl<'a, S> Send for RobotsMatcher<'a, S> where
S: Send,
[src]
S: Send,
impl<'a, S> Sync for RobotsMatcher<'a, S> where
S: Sync,
[src]
S: Sync,
impl<'a, S> Unpin for RobotsMatcher<'a, S> where
S: Unpin,
[src]
S: Unpin,
impl<'a, S> UnwindSafe for RobotsMatcher<'a, S> where
S: UnwindSafe,
[src]
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,