api: let ConstRegexPattern deref to Regex
This way we can just use `SOME_REGEX.is_match()` again without having to explicitly call `(SOME_REGEX.regex_obj)()` first. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
197b1bccb3
commit
8a6e741d6c
@ -19,6 +19,14 @@ impl fmt::Debug for ConstRegexPattern {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for ConstRegexPattern {
|
||||
type Target = regex::Regex;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
(self.regex_obj)()
|
||||
}
|
||||
}
|
||||
|
||||
/// Macro to generate a ConstRegexPattern
|
||||
///
|
||||
/// ```
|
||||
|
Loading…
x
Reference in New Issue
Block a user