Skip to content

Commit

Permalink
Add examples to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrudy committed Mar 30, 2024
1 parent 4484f62 commit 20d57dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@ Disallow: /private
Disallow: /tmp
"#.parse::<Robots>().unwrap();

assert_eq!(robots.allowed("/public"), true);
let user_agent = "googlebot".parse().unwrap();

assert_eq!(robots.is_allowed(&user_agent, "/public"), true);
```
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ use crate::error::DirectivePathParseError;
use crate::error::RobotParseError;
use crate::error::UserAgentParseError;

#[doc(hidden)]
mod readme {
#![doc = include_str!("../README.md")]
}

const TSPECIALS: &str = "()<>@,;:\\\"/[]?={} \t";
const PSAFE: &str = "$-_.+~";
const PEXTRA: &str = "!*'(),";
Expand Down

0 comments on commit 20d57dd

Please sign in to comment.