Struct git_attributes::MatchGroup
source · [−]pub struct MatchGroup<T: Pattern = Attributes> {
pub patterns: Vec<PatternList<T>>,
}
Expand description
A grouping of lists of patterns while possibly keeping associated to their base path.
Pattern lists with base path are queryable relative to that base, otherwise they are relative to the repository root.
Fields
patterns: Vec<PatternList<T>>
A list of pattern lists, each representing a patterns from a file or specified by hand, in the order they were specified in.
During matching, this order is reversed.
Implementations
sourceimpl<T> MatchGroup<T> where
T: Pattern,
impl<T> MatchGroup<T> where
T: Pattern,
sourceimpl MatchGroup<Ignore>
impl MatchGroup<Ignore>
sourcepub fn from_git_dir(
git_dir: impl AsRef<Path>,
excludes_file: Option<PathBuf>,
buf: &mut Vec<u8>
) -> Result<Self>
pub fn from_git_dir(
git_dir: impl AsRef<Path>,
excludes_file: Option<PathBuf>,
buf: &mut Vec<u8>
) -> Result<Self>
Given git_dir
, a .git
repository, load ignore patterns from info/exclude
and from excludes_file
if it
is provided.
Note that it’s not considered an error if the provided excludes_file
does not exist.
sourcepub fn from_overrides(
patterns: impl IntoIterator<Item = impl Into<OsString>>
) -> Self
pub fn from_overrides(
patterns: impl IntoIterator<Item = impl Into<OsString>>
) -> Self
See PatternList::
sourcepub fn add_patterns_file(
&mut self,
source: impl Into<PathBuf>,
follow_symlinks: bool,
root: Option<&Path>,
buf: &mut Vec<u8>
) -> Result<bool>
pub fn add_patterns_file(
&mut self,
source: impl Into<PathBuf>,
follow_symlinks: bool,
root: Option<&Path>,
buf: &mut Vec<u8>
) -> Result<bool>
Add the given file at source
if it exists, otherwise do nothing. If a root
is provided, it’s not considered a global file anymore.
Returns true if the file was added, or false if it didn’t exist.
sourcepub fn add_patterns_buffer(
&mut self,
bytes: &[u8],
source: impl Into<PathBuf>,
root: Option<&Path>
)
pub fn add_patterns_buffer(
&mut self,
bytes: &[u8],
source: impl Into<PathBuf>,
root: Option<&Path>
)
Add patterns as parsed from bytes
, providing their source
path and possibly their root
path, the path they
are relative to. This also means that source
is contained within root
if root
is provided.
Trait Implementations
sourceimpl<T: Clone + Pattern> Clone for MatchGroup<T>
impl<T: Clone + Pattern> Clone for MatchGroup<T>
sourcefn clone(&self) -> MatchGroup<T>
fn clone(&self) -> MatchGroup<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T: Debug + Pattern> Debug for MatchGroup<T>
impl<T: Debug + Pattern> Debug for MatchGroup<T>
sourceimpl<T: Default + Pattern> Default for MatchGroup<T>
impl<T: Default + Pattern> Default for MatchGroup<T>
sourcefn default() -> MatchGroup<T>
fn default() -> MatchGroup<T>
Returns the “default value” for a type. Read more
sourceimpl<T: Hash + Pattern> Hash for MatchGroup<T>
impl<T: Hash + Pattern> Hash for MatchGroup<T>
sourceimpl<T: Ord + Pattern> Ord for MatchGroup<T>
impl<T: Ord + Pattern> Ord for MatchGroup<T>
sourcefn cmp(&self, other: &MatchGroup<T>) -> Ordering
fn cmp(&self, other: &MatchGroup<T>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: PartialEq + Pattern> PartialEq<MatchGroup<T>> for MatchGroup<T>
impl<T: PartialEq + Pattern> PartialEq<MatchGroup<T>> for MatchGroup<T>
sourcefn eq(&self, other: &MatchGroup<T>) -> bool
fn eq(&self, other: &MatchGroup<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MatchGroup<T>) -> bool
fn ne(&self, other: &MatchGroup<T>) -> bool
This method tests for !=
.
sourceimpl<T: PartialOrd + Pattern> PartialOrd<MatchGroup<T>> for MatchGroup<T>
impl<T: PartialOrd + Pattern> PartialOrd<MatchGroup<T>> for MatchGroup<T>
sourcefn partial_cmp(&self, other: &MatchGroup<T>) -> Option<Ordering>
fn partial_cmp(&self, other: &MatchGroup<T>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<T: Eq + Pattern> Eq for MatchGroup<T>
impl<T: Pattern> StructuralEq for MatchGroup<T>
impl<T: Pattern> StructuralPartialEq for MatchGroup<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for MatchGroup<T> where
<T as Pattern>::Value: RefUnwindSafe,
impl<T> Send for MatchGroup<T> where
<T as Pattern>::Value: Send,
impl<T> Sync for MatchGroup<T> where
<T as Pattern>::Value: Sync,
impl<T> Unpin for MatchGroup<T> where
<T as Pattern>::Value: Unpin,
impl<T> UnwindSafe for MatchGroup<T> where
<T as Pattern>::Value: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more