Struct robotstxt::matcher::RobotsMatcher[][src]

pub struct RobotsMatcher<'a, S: RobotsMatchStrategy> { /* fields omitted */ }

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]

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]

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]

impl<S: RobotsMatchStrategy> RobotsParseHandler for RobotsMatcher<'_, S>[src]

Auto Trait Implementations

impl<'a, S> RefUnwindSafe for RobotsMatcher<'a, S> where
    S: RefUnwindSafe
[src]

impl<'a, S> Send for RobotsMatcher<'a, S> where
    S: Send
[src]

impl<'a, S> Sync for RobotsMatcher<'a, S> where
    S: Sync
[src]

impl<'a, S> Unpin for RobotsMatcher<'a, S> where
    S: Unpin
[src]

impl<'a, S> UnwindSafe for RobotsMatcher<'a, S> where
    S: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.