pub struct ExclusionMatcher<S: Clone + AsRef<str>> { /* private fields */ }Expand description
Compiled matcher for a list of exclusion patterns.
Split patterns are stored once at construction time so that per-file matching is cheap. See the module-level documentation for the exact semantics.
Implementations§
Source§impl<S: Clone + AsRef<str>> ExclusionMatcher<S>
impl<S: Clone + AsRef<str>> ExclusionMatcher<S>
Sourcepub fn compile<I>(
patterns: I,
glob_settings: GlobSettings,
) -> Result<Self, DatabaseError>where
I: IntoIterator<Item = S>,
pub fn compile<I>(
patterns: I,
glob_settings: GlobSettings,
) -> Result<Self, DatabaseError>where
I: IntoIterator<Item = S>,
Builds a matcher from a list of patterns and the project’s glob settings.
§Errors
Returns a DatabaseError::InvalidGlobSet if any glob pattern fails to compile.
Sourcepub fn is_match(&self, file: &str) -> bool
pub fn is_match(&self, file: &str) -> bool
Returns true if file matches any of the configured patterns.
file is expected to be a forward-slash-separated path string
relative to whatever root the caller considers meaningful (typically
the workspace root for source excludes, or the logical
File::name for per-rule excludes).
Trait Implementations§
Auto Trait Implementations§
impl<S> Forget for ExclusionMatcher<S>
impl<S> Freeze for ExclusionMatcher<S>where
*const u8 is !null: Freeze,
PhantomData<GlobSetMatchStrategy>: Freeze,
PhantomData<Glob>: Freeze,
PhantomData<S>: Freeze,
impl<S> Move for ExclusionMatcher<S>
impl<S> RefUnwindSafe for ExclusionMatcher<S>where
Atomic<usize>: RefUnwindSafe,
Pool<Cache, Box<dyn Fn() -> Cache + UnwindSafe + RefUnwindSafe + Sync + Send>>: RefUnwindSafe,
Pool<PatternSet, Box<dyn Fn() -> PatternSet + UnwindSafe + RefUnwindSafe + Sync + Send>>: RefUnwindSafe,
S: RefUnwindSafe,
impl<S> Send for ExclusionMatcher<S>where
S: Send,
RawVecInner: Send,
RawTable<(Vec<u8>, Vec<usize>)>: Send,
Arc<dyn AcAutomaton>: Send,
RawTable<(Vec<u8>, Vec<(usize, Regex)>)>: Send,
Arc<RegexI>: Send,
BoxRaw<Pool<Cache, Box<dyn Fn() -> Cache + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Send,
Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Send,
impl<S> Sync for ExclusionMatcher<S>where
S: Sync,
RawVecInner: Sync,
RawTable<(Vec<u8>, Vec<usize>)>: Sync,
Arc<dyn AcAutomaton>: Sync,
RawTable<(Vec<u8>, Vec<(usize, Regex)>)>: Sync,
Arc<RegexI>: Sync,
BoxRaw<Pool<Cache, Box<dyn Fn() -> Cache + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Sync,
Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Sync,
impl<S> Unpin for ExclusionMatcher<S>where
S: Unpin,
*const u8 is !null: Unpin,
Arc<dyn AcAutomaton>: Unpin,
Arc<RegexI>: Unpin,
Box<Pool<Cache, Box<dyn Fn() -> Cache + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Unpin,
Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + UnwindSafe + RefUnwindSafe + Sync + Send>>>: Unpin,
impl<S> UnsafeUnpin for ExclusionMatcher<S>where
*const u8 is !null: UnsafeUnpin,
PhantomData<GlobSetMatchStrategy>: UnsafeUnpin,
PhantomData<Glob>: UnsafeUnpin,
PhantomData<S>: UnsafeUnpin,
impl<S> UnwindSafe for ExclusionMatcher<S>where
RawVecInner: UnwindSafe,
HashMap<Vec<u8>, Vec<usize>, BuildHasherDefault<Hasher>>: UnwindSafe,
Arc<dyn AcAutomaton>: UnwindSafe,
HashMap<Vec<u8>, Vec<(usize, Regex)>, BuildHasherDefault<Hasher>>: UnwindSafe,
Arc<RegexI>: UnwindSafe,
BoxRaw<Pool<Cache, Box<dyn Fn() -> Cache + UnwindSafe + RefUnwindSafe + Sync + Send>>>: UnwindSafe,
Arc<Pool<PatternSet, Box<dyn Fn() -> PatternSet + UnwindSafe + RefUnwindSafe + Sync + Send>>>: UnwindSafe,
S: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more