Skip to content

Commit

Permalink
add Pattern impl for &'a Regex
Browse files Browse the repository at this point in the history
  • Loading branch information
sam0x17 committed Apr 1, 2024
1 parent a5e50c9 commit 2d4d598
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,12 @@ impl Pattern for Regex {
}
}

impl<'a> Pattern for &'a Regex {
fn try_to_regex(self) -> core::result::Result<Regex, regex::Error> {
Ok(self.clone())
}
}

impl Pattern for &str {
fn try_to_regex(self) -> core::result::Result<Regex, regex::Error> {
Regex::new(self)
Expand Down

0 comments on commit 2d4d598

Please sign in to comment.