RobotsTxtParser

Struct RobotsTxtParser 

Source
pub struct RobotsTxtParser<'a, Handler: RobotsParseHandler> { /* private fields */ }
Expand description

A robotstxt parser.

Implementations§

Source§

impl<'a, Handler: RobotsParseHandler> RobotsTxtParser<'a, Handler>

Source

pub fn new(robots_body: &'a str, handler: &'a mut Handler) -> Self

Source

pub fn parse(&mut self)

Parse body of this Parser’s robots.txt and emit parse callbacks. This will accept typical typos found in robots.txt, such as ‘disalow’.

Note, this function will accept all kind of input but will skip everything that does not look like a robots directive.

Source

pub fn parse_key_value(line: &str) -> (&str, &str, bool)

Attempts to parse a line of robots.txt into a key/value pair.

On success, the parsed key and value, and true, are returned. If parsing is unsuccessful, parse_key_value returns two empty strings and false.

Source

pub fn need_escape_value_for_key(key: &ParsedRobotsKey) -> bool

Auto Trait Implementations§

§

impl<'a, Handler> Freeze for RobotsTxtParser<'a, Handler>

§

impl<'a, Handler> RefUnwindSafe for RobotsTxtParser<'a, Handler>
where Handler: RefUnwindSafe,

§

impl<'a, Handler> Send for RobotsTxtParser<'a, Handler>
where Handler: Send,

§

impl<'a, Handler> Sync for RobotsTxtParser<'a, Handler>
where Handler: Sync,

§

impl<'a, Handler> Unpin for RobotsTxtParser<'a, Handler>

§

impl<'a, Handler> !UnwindSafe for RobotsTxtParser<'a, Handler>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.