pub struct PathspecElement { /* private fields */ }Expand description
A parsed pathspec element: a single pattern plus its magic flags.
Mirrors git’s struct pathspec_item for the subset sley needs today.
Construct with PathspecElement::parse; query with
[PathspecElement::matches].
Implementations§
Source§impl PathspecElement
impl PathspecElement
Sourcepub fn parse(
arg: &[u8],
defaults: PathspecMatchMagic,
) -> Result<Self, PathspecParseError>
pub fn parse( arg: &[u8], defaults: PathspecMatchMagic, ) -> Result<Self, PathspecParseError>
Parse one pathspec argument, honoring git’s magic prefixes.
Recognizes both the long form :(magic1,magic2,...)pattern and the
shorthand sigils :!/:^ (exclude), :/ (top). Defaults
(literal/glob/icase from the global --*-pathspecs flags) are
supplied via defaults and overridden per-element by any explicit
magic. Unknown long-form magic words are an error, matching git.
Sourcepub fn is_exclude(&self) -> bool
pub fn is_exclude(&self) -> bool
Whether this element is an :(exclude) element.
pub fn attr_requirements(&self) -> &[PathspecAttrRequirement]
Sourcepub fn magic(&self) -> PathspecMatchMagic
pub fn magic(&self) -> PathspecMatchMagic
The PathspecMatchMagic this element matches under.
Sourcepub fn matches_path(&self, name: &[u8]) -> bool
pub fn matches_path(&self, name: &[u8]) -> bool
Whether name (a repo-relative path, no leading slash) is selected by
this single element, ignoring its exclude polarity. Use
Pathspec::matches for the combined include/exclude semantics.
pub fn with_pattern(self, pattern: Vec<u8>) -> Self
Trait Implementations§
Source§impl Clone for PathspecElement
impl Clone for PathspecElement
Source§fn clone(&self) -> PathspecElement
fn clone(&self) -> PathspecElement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PathspecElement
impl Debug for PathspecElement
impl Eq for PathspecElement
Source§impl PartialEq for PathspecElement
impl PartialEq for PathspecElement
Source§fn eq(&self, other: &PathspecElement) -> bool
fn eq(&self, other: &PathspecElement) -> bool
self and other values to be equal, and is used by ==.