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>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl<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>
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) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
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
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>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more