fixed documentation on crates.io

This commit is contained in:
Frederik Palmø 2022-11-15 13:15:39 +01:00
parent 154840f9f8
commit 2120f8c481
2 changed files with 19 additions and 19 deletions

View file

@ -13,22 +13,22 @@ The only special characters in templates are curly brackets ('{}'). These act as
## Examples: ## Examples:
```rust ```rust
# #[macro_use] extern crate eyes; #[macro_use] extern crate eyes; // not normally necessary
# fn main() { fn main() {
let input = "#lol @ 338,7643: 20.2x24.5"; let input = "#lol @ 338,7643: 20.2x24.5";
let template = "#{} @ {},{}: {}x{}"; let template = "#{} @ {},{}: {}x{}";
let (id, x, y, w, h) = eyes::parse!(input, template, String, isize, isize, f64, f64); let (id, x, y, w, h) = eyes::parse!(input, template, String, isize, isize, f64, f64);
assert_eq!((id.as_str(), x, y, w, h), ("lol", 338, 7643, 20.2, 24.5)); assert_eq!((id.as_str(), x, y, w, h), ("lol", 338, 7643, 20.2, 24.5));
# } }
``` ```
**eyes** will try to expand capture groups, so that the following example also works as expected: **eyes** will try to expand capture groups, so that the following example also works as expected:
```rust ```rust
# #[macro_use] extern crate eyes; #[macro_use] extern crate eyes; // not normally necessary
# fn main() { fn main() {
let input = "turn off 660,55 through 986,197"; let input = "turn off 660,55 through 986,197";
let template = "{} {},{} through {},{}"; let template = "{} {},{} through {},{}";
@ -38,7 +38,7 @@ assert_eq!(
(op.as_str(), x1, y1, x2, y2), (op.as_str(), x1, y1, x2, y2),
("turn off", 660, 55, 986, 197) ("turn off", 660, 55, 986, 197)
); );
# } }
``` ```
Notice that "turn off" is captured correctly, even though it contains a space. Notice that "turn off" is captured correctly, even though it contains a space.

View file

@ -15,7 +15,7 @@ impl<'a> Captures<'a> {
/// ///
/// The input and template strings must live as long as the list of captures itself, as the captures list borrows from them. /// The input and template strings must live as long as the list of captures itself, as the captures list borrows from them.
/// ///
/// # Examples /// ## Examples
/// ///
/// Basic usage: /// Basic usage:
/// ``` /// ```
@ -124,7 +124,7 @@ macro_rules! try_parse {
/// - The template does not match the input. /// - The template does not match the input.
/// - The capture could not be converted to the specified type. /// - The capture could not be converted to the specified type.
/// ///
/// # Examples /// ## Examples
/// ///
/// Basic usage: /// Basic usage:
/// ``` /// ```