Skip to main content

IgnorePatternSet

Struct IgnorePatternSet 

Source
pub struct IgnorePatternSet { /* private fields */ }
Expand description

The discovery ignore set with its ! exceptions.

matches_into and len read only the ignore globs, in the index layout that crate::DEFAULT_IGNORE_PATTERNS documents. is_match applies the exceptions too, so every caller that asks “is this path ignored” gets the same answer.

Implementations§

Source§

impl IgnorePatternSet

Source

pub fn empty() -> Self

A set that ignores nothing.

Source

pub fn new(patterns: GlobSet, exception_bodies: &[&str]) -> Self

Build a set from ignore globs and ! exception bodies (without the !). Exception bodies that do not compile are dropped, because config load validates them first.

Source

pub fn with_user_patterns(self, patterns: Vec<String>) -> Self

Name the project’s own globs, which are the first patterns.len() globs of the set, as written in ignorePatterns.

Source

pub fn user_pattern_count(&self) -> usize

Number of the project’s own globs at the front of the set.

Source

pub fn credit_user_matches(&self, indices: &[usize])

Credit the project’s own globs among indices (from Self::excluded_matches_into for one excluded path), unless a built-in glob is among them too: the built-in excludes the path anyway.

Source

pub fn excludes(&self, path: impl AsRef<Path>) -> bool

Self::is_match, and when the path is ignored, credit the project’s own globs that match it, as Self::credit_user_matches does.

Source

pub fn mark_walked(&self)

Record that source discovery ran with this set.

Source

pub fn redundant_user_patterns(&self) -> Vec<&str>

The project’s own globs that excluded no path that the run would otherwise keep, in config order. Empty until source discovery ran.

A glob that names a hidden directory (.cache/**) is never in the list. The walk does not open most hidden directories, so it cannot credit such a glob, but the glob still silences the skipped-source-dotdir advisory for that directory.

Source

pub fn is_match(&self, path: impl AsRef<Path>) -> bool

True when the path is ignored: an ignore glob matches it and no ! exception lifts it.

Source

pub fn excluded_matches_into( &self, path: impl AsRef<Path>, into: &mut Vec<usize>, )

Indices of the ignore globs that match the path, without the exceptions. Callers use it only for a path that is_match rejected, so it also credits the project’s own globs among the indices.

Source

pub fn matches(&self, path: impl AsRef<Path>) -> Vec<usize>

Indices of the ignore globs that match the path, without the exceptions.

Source

pub fn len(&self) -> usize

Number of ignore globs, without the exceptions.

Source

pub fn is_empty(&self) -> bool

True when the set has no ignore globs.

Source

pub fn has_exceptions(&self) -> bool

True when the project wrote at least one ! exception.

Source

pub fn is_lifted(&self, path: impl AsRef<Path>) -> bool

True when a ! exception matches the path and the path is not under node_modules or .git.

Source

pub fn admits_hidden_dir(&self, dir: &Path) -> bool

True when the walk must open the hidden directory dir (a path relative to the project root) because a ! exception can match a file inside it. The walk keeps only the files that an exception matches.

Trait Implementations§

Source§

impl Clone for IgnorePatternSet

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IgnorePatternSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IgnorePatternSet

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<GlobSet> for IgnorePatternSet

Source§

fn from(patterns: GlobSet) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more