Skip to main content

IgnoreSpec

Struct IgnoreSpec 

Source
pub struct IgnoreSpec {
    pub gitignore: bool,
    pub dot_ignore: bool,
    pub exclude_git: bool,
    pub patterns: Vec<String>,
}
Expand description

What a sync excludes. Part of the shared root’s identity (crate::RootKey): two syncs indexing different trees cannot share a reconciler, exactly as for recursive — so this derives Hash/Eq over the normalized pattern list rather than over a compiled matcher.

Fields§

§gitignore: bool

Honor .gitignore in and above the root, plus the governing repository’s $GIT_DIR/info/exclude and the user’s core.excludesFile.

§dot_ignore: bool

Honor .ignore in and above the root — ripgrep’s convention, which a project can use to hide things from tooling without telling git to stop tracking them.

§exclude_git: bool

Omit every entry whose final component is exactly .git.

§patterns: Vec<String>

Extra gitignore-syntax patterns, root-anchored, highest precedence.

Implementations§

Source§

impl IgnoreSpec

Source

pub fn is_empty(&self) -> bool

Nothing to exclude: the reconciler skips building a matcher at all, so an unfiltered sync pays exactly what it paid before.

Source

pub fn reads_ignore_files(&self) -> bool

Whether any per-directory ignore file is consulted.

Source

pub fn file_names(&self) -> Vec<&'static str>

Per-directory ignore file names this spec reads, ascending precedence within one directory.

Source

pub fn parse_patterns(text: &str) -> Vec<String>

Normalize the wire form — one gitignore line per \n — into the pattern list. Blank lines and # comments are dropped here rather than at compile time so that two specs differing only in whitespace share one shared root.

Order carries meaning only when a negation is present, since gitignore’s rule is last-match-wins and a list of pure exclusions commutes. Such a list is therefore sorted and deduplicated, so two clients that asked for the same thing in a different order share one root instead of building two identical indexes. A list with a ! in it is left exactly as written — reordering it would change what it means.

Trait Implementations§

Source§

impl Clone for IgnoreSpec

Source§

fn clone(&self) -> IgnoreSpec

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 IgnoreSpec

Source§

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

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

impl Default for IgnoreSpec

Source§

fn default() -> IgnoreSpec

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

impl Eq for IgnoreSpec

Source§

impl Hash for IgnoreSpec

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IgnoreSpec

Source§

fn eq(&self, other: &IgnoreSpec) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for IgnoreSpec

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.