pub enum Exclusion<'a> {
Path(Cow<'a, Path>),
Pattern(Cow<'a, str>),
}Expand description
A rule for excluding files or directories from filesystem scans.
This enum represents two types of exclusion rules that can be used when loading
a database to filter out unwanted files. Exclusions are evaluated during the
scan performed by DatabaseLoader.
§Lifetime
The 'a lifetime parameter allows the exclusion to borrow paths and patterns
from configuration or other long-lived data structures, avoiding unnecessary
allocations during database construction.
§Variants
§Path Exclusion
Excludes an exact filesystem path, which can be either a file or directory. When a directory is excluded, all files and subdirectories within it are also excluded.
Paths can be absolute or relative to the workspace. Relative paths are canonicalized during loader construction.
§Pattern Exclusion
Excludes paths matching a glob pattern. Glob patterns support wildcards and are matched against the full path of each discovered file.
Common pattern syntax:
*matches any characters except path separators**matches any characters including path separators (recursive)?matches a single character[abc]matches one character from the set
§Ordering
Exclusions are ordered first by variant (Path before Pattern), then by the value within the variant. This enables efficient deduplication and set operations.
Variants§
Path(Cow<'a, Path>)
Exclude a specific file or directory by its exact path.
The path can be absolute or relative to the workspace directory. If a directory is specified, all contents within it are recursively excluded.
Uses Cow to allow borrowing paths from configuration while supporting
owned paths when canonicalization is required.
Pattern(Cow<'a, str>)
Exclude files and directories matching a glob pattern.
The pattern is evaluated against the full path of each file discovered during the scan. Supports standard glob syntax including wildcards, character classes, and recursive matchers.
Uses Cow to avoid allocating when borrowing patterns from configuration.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Exclusion<'a>
impl<'de, 'a> Deserialize<'de> for Exclusion<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> Ord for Exclusion<'a>
impl<'a> Ord for Exclusion<'a>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<'a> PartialOrd for Exclusion<'a>
impl<'a> PartialOrd for Exclusion<'a>
impl<'a> Eq for Exclusion<'a>
impl<'a> StructuralPartialEq for Exclusion<'a>
Auto Trait Implementations§
impl<'a> Freeze for Exclusion<'a>
impl<'a> RefUnwindSafe for Exclusion<'a>
impl<'a> Send for Exclusion<'a>
impl<'a> Sync for Exclusion<'a>
impl<'a> Unpin for Exclusion<'a>
impl<'a> UnwindSafe for Exclusion<'a>
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
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>
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>
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