mirror of
https://github.com/danbulant/robotparser-rs
synced 2026-05-24 12:35:49 +00:00
Better documentation
This commit is contained in:
parent
2d9c028dfa
commit
7f9d08b307
2 changed files with 27 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ Add it to your ``Cargo.toml``:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
robotparser = "*"
|
robotparser = "0.4"
|
||||||
```
|
```
|
||||||
|
|
||||||
Add ``extern crate robotparser`` to your crate root and your're good to go!
|
Add ``extern crate robotparser`` to your crate root and your're good to go!
|
||||||
|
|
|
||||||
26
src/lib.rs
26
src/lib.rs
|
|
@ -4,6 +4,31 @@
|
||||||
//! The robots.txt Exclusion Protocol is implemented as specified in
|
//! The robots.txt Exclusion Protocol is implemented as specified in
|
||||||
//! http://www.robotstxt.org/norobots-rfc.txt
|
//! http://www.robotstxt.org/norobots-rfc.txt
|
||||||
//!
|
//!
|
||||||
|
//! # Installation
|
||||||
|
//!
|
||||||
|
//! Add it to your ``Cargo.toml``:
|
||||||
|
//!
|
||||||
|
//! ```toml
|
||||||
|
//! [dependencies]
|
||||||
|
//! robotparser = "0.4"
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Add ``extern crate robotparser`` to your crate root and your're good to go!
|
||||||
|
//!
|
||||||
|
//! # Examples
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! extern crate robotparser;
|
||||||
|
//!
|
||||||
|
//! use robotparser::RobotFileParser;
|
||||||
|
//!
|
||||||
|
//! fn main() {
|
||||||
|
//! let parser = RobotFileParser::new("http://www.python.org/robots.txt");
|
||||||
|
//! parser.read();
|
||||||
|
//! assert!(parser.can_fetch("*", "http://www.python.org/robots.txt"));
|
||||||
|
//! }
|
||||||
|
//! ```
|
||||||
|
|
||||||
#![cfg_attr(feature="clippy", feature(plugin))]
|
#![cfg_attr(feature="clippy", feature(plugin))]
|
||||||
#![cfg_attr(feature="clippy", plugin(clippy))]
|
#![cfg_attr(feature="clippy", plugin(clippy))]
|
||||||
#![cfg_attr(feature="clippy", deny(clippy))]
|
#![cfg_attr(feature="clippy", deny(clippy))]
|
||||||
|
|
@ -37,6 +62,7 @@ struct Entry {
|
||||||
sitemaps: Vec<Url>,
|
sitemaps: Vec<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// robots.txt file parser
|
||||||
#[derive(Debug, Eq, PartialEq, Clone)]
|
#[derive(Debug, Eq, PartialEq, Clone)]
|
||||||
pub struct RobotFileParser {
|
pub struct RobotFileParser {
|
||||||
entries: RefCell<Vec<Entry>>,
|
entries: RefCell<Vec<Entry>>,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue