pub struct WorkspaceMatcher { /* private fields */ }Expand description
Resolves whether a single path belongs to the workspace database and, if so,
as which FileType. Built once from a DatabaseConfiguration; cheap to
query per path.
Implementations§
Source§impl WorkspaceMatcher
impl WorkspaceMatcher
Sourcepub fn from_configuration(
configuration: &DatabaseConfiguration<'_>,
) -> Result<Self, DatabaseError>
pub fn from_configuration( configuration: &DatabaseConfiguration<'_>, ) -> Result<Self, DatabaseError>
Builds a matcher from a database configuration.
§Errors
Returns a DatabaseError if a source or exclude glob fails to compile.
Sourcepub fn classify(&self, file: &Path) -> Option<FileType>
pub fn classify(&self, file: &Path) -> Option<FileType>
Returns the FileType for file if it would be part of the database,
or None if the path lies outside every configured root or is excluded.
Sourcepub fn contains(&self, path: &Path) -> bool
pub fn contains(&self, path: &Path) -> bool
Returns true if path would be part of the database.
Sourcepub fn watch_roots(&self) -> impl Iterator<Item = &Path>
pub fn watch_roots(&self) -> impl Iterator<Item = &Path>
Roots for filesystem watchers, filtered by exclusions rather than file membership.
Sourcepub fn can_contain_files(&self, directory: &Path) -> bool
pub fn can_contain_files(&self, directory: &Path) -> bool
Whether a directory can contain files from any configured source.
Sourcepub fn extensions(&self) -> impl Iterator<Item = &OsStr>
pub fn extensions(&self) -> impl Iterator<Item = &OsStr>
File extensions accepted below the configured roots.
Sourcepub fn is_excluded(&self, canonical: &Path) -> bool
pub fn is_excluded(&self, canonical: &Path) -> bool
Check an absolute source path against the configured exclusions.
Trait Implementations§
Source§impl Clone for WorkspaceMatcher
impl Clone for WorkspaceMatcher
Auto Trait Implementations§
impl Freeze for WorkspaceMatcher
impl RefUnwindSafe for WorkspaceMatcher
impl Send for WorkspaceMatcher
impl Sync for WorkspaceMatcher
impl Unpin for WorkspaceMatcher
impl UnsafeUnpin for WorkspaceMatcher
impl UnwindSafe for WorkspaceMatcher
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