pub enum CompiledMatcher {
Exact(String),
Glob(GlobMatcher),
Regex(Regex),
}Expand description
A matcher pattern compiled once at config-parse time.
Variants§
Exact(String)
Case-insensitive literal match. No wildcards, no regex metacharacters.
Glob(GlobMatcher)
globset-backed glob match. *.example.com matches subtree.
Regex(Regex)
Regular-expression match.
Implementations§
Source§impl CompiledMatcher
impl CompiledMatcher
Sourcepub fn compile(pattern: &str) -> Result<Self, MatcherCompileError>
pub fn compile(pattern: &str) -> Result<Self, MatcherCompileError>
Compile an event-matcher pattern. Patterns containing regex
metacharacters are treated as regex; patterns containing only glob
wildcards (*, ?) are compiled as globs; everything else is a
case-insensitive literal.
Sourcepub fn compile_regex(pattern: &str) -> Result<Self, MatcherCompileError>
pub fn compile_regex(pattern: &str) -> Result<Self, MatcherCompileError>
Force-compile a pattern as a regex, regardless of shape. Used when
the caller wants regex semantics explicitly (event matcher strings in
hooks.json).
Sourcepub fn compile_glob(pattern: &str) -> Result<Self, MatcherCompileError>
pub fn compile_glob(pattern: &str) -> Result<Self, MatcherCompileError>
Force-compile a pattern as a glob. *.example.com becomes a subtree
match. The bare * is retained as a universal match.
pub fn is_match(&self, input: &str) -> bool
Trait Implementations§
Source§impl Clone for CompiledMatcher
impl Clone for CompiledMatcher
Source§fn clone(&self) -> CompiledMatcher
fn clone(&self) -> CompiledMatcher
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 CompiledMatcher
impl RefUnwindSafe for CompiledMatcher
impl Send for CompiledMatcher
impl Sync for CompiledMatcher
impl Unpin for CompiledMatcher
impl UnsafeUnpin for CompiledMatcher
impl UnwindSafe for CompiledMatcher
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