diff options
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1026,8 +1026,8 @@ pub mod str { } } - pub fn regex<'a>(pattern: &'a str) -> impl Parser<&'a str, Output = &'a str> { - Regex(regex::Regex::new(pattern).unwrap()) + pub fn regex<'a>(regexp: regex::Regex) -> impl Parser<&'a str, Output = &'a str> { + Regex(regexp) } } @@ -1050,7 +1050,7 @@ mod test { fn test_regex_parser() { let it = InputIter::new("abc 123"); - match crate::str::regex("[abc]+").parse(it) { + match crate::str::regex(regex::Regex::new("[a-z]+").unwrap()).parse(it) { Ok((rest, output)) => { assert_eq!(output, "abc"); assert_eq!(rest.rest(), " 123"); |
