pub enum CompatRegex {
Fast(Regex),
Fancy(Regex),
}Expand description
A compiled regex that uses either the fast regex backend or the
fancy_regex backend for pproxy compatibility mode.
The fancy_regex backend supports Perl/Python-like constructs such as
look-around and backreferences, which are common in pproxy rule files.
The fast backend is used when fancy features are not needed.
Variants§
Implementations§
Source§impl CompatRegex
impl CompatRegex
Sourcepub fn compile(pattern: &str) -> Result<Self, RegexCompileError>
pub fn compile(pattern: &str) -> Result<Self, RegexCompileError>
Try to compile a pattern using the fast regex backend first.
Falls back to fancy_regex if the pattern contains unsupported
constructs (look-around, backreferences, etc.).
Sourcepub fn compile_fancy(pattern: &str) -> Result<Self, RegexCompileError>
pub fn compile_fancy(pattern: &str) -> Result<Self, RegexCompileError>
Compile using only the fancy_regex backend (force compatibility mode).
Sourcepub fn is_match(&self, text: &str) -> Result<bool, RegexMatchError>
pub fn is_match(&self, text: &str) -> Result<bool, RegexMatchError>
Returns true if the given text matches this regex.
Sourcepub fn backend(&self) -> RegexBackend
pub fn backend(&self) -> RegexBackend
Returns the backend used for this compiled regex.
Trait Implementations§
Source§impl Clone for CompatRegex
impl Clone for CompatRegex
Source§fn clone(&self) -> CompatRegex
fn clone(&self) -> CompatRegex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CompatRegex
impl RefUnwindSafe for CompatRegex
impl Send for CompatRegex
impl Sync for CompatRegex
impl Unpin for CompatRegex
impl UnsafeUnpin for CompatRegex
impl UnwindSafe for CompatRegex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more