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:
Wolfgang Bumiller 2019-12-04 11:06:00 +01:00
parent 197b1bccb3
commit 8a6e741d6c

View File

@ -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
///
/// ```