pub struct MatchEntry { /* private fields */ }
Expand description
A single entry in a MatchList
.
Implementations§
Source§impl MatchEntry
impl MatchEntry
Sourcepub fn new<T: Into<MatchPattern>>(pattern: T, ty: MatchType) -> Self
pub fn new<T: Into<MatchPattern>>(pattern: T, ty: MatchType) -> Self
Create a new match entry.
Sourcepub fn include<T: Into<MatchPattern>>(pattern: T) -> Self
pub fn include<T: Into<MatchPattern>>(pattern: T) -> Self
Create a new include-type match entry with default flags.
Sourcepub fn exclude<T: Into<MatchPattern>>(pattern: T) -> Self
pub fn exclude<T: Into<MatchPattern>>(pattern: T) -> Self
Create a new exclude-type match entry with default flags.
Sourcepub fn flags(self, flags: MatchFlag) -> Self
pub fn flags(self, flags: MatchFlag) -> Self
Builder method to set the match flags to a specific value.
Sourcepub fn add_flags(self, flags: MatchFlag) -> Self
pub fn add_flags(self, flags: MatchFlag) -> Self
Builder method to add flag bits to the already present ones.
Sourcepub fn remove_flags(self, flags: MatchFlag) -> Self
pub fn remove_flags(self, flags: MatchFlag) -> Self
Builder method to remove match flag bits.
Sourcepub fn toggle_flags(self, flags: MatchFlag) -> Self
pub fn toggle_flags(self, flags: MatchFlag) -> Self
Builder method to toggle flag bits.
pub fn match_type(&self) -> MatchType
Sourcepub fn match_type_mut(&mut self) -> &mut MatchType
pub fn match_type_mut(&mut self) -> &mut MatchType
Non-Builder method to change the match type.
Sourcepub fn pattern(&self) -> &MatchPattern
pub fn pattern(&self) -> &MatchPattern
Directly access the pattern.
Sourcepub fn pattern_mut(&mut self) -> &mut MatchPattern
pub fn pattern_mut(&mut self) -> &mut MatchPattern
Non-Builder method to change the pattern.
Sourcepub fn match_flags(&self) -> MatchFlag
pub fn match_flags(&self) -> MatchFlag
Directly access the match flags.
Sourcepub fn match_flags_mut(&mut self) -> &mut MatchFlag
pub fn match_flags_mut(&mut self) -> &mut MatchFlag
Non-Builder method to change the flags.
Sourcepub fn parse_pattern<T: AsRef<[u8]>>(
pattern: T,
pattern_flags: PatternFlag,
ty: MatchType,
) -> Result<Self, ParseError>
pub fn parse_pattern<T: AsRef<[u8]>>( pattern: T, pattern_flags: PatternFlag, ty: MatchType, ) -> Result<Self, ParseError>
Parse a pattern into a MatchEntry
while interpreting a leading exclamation mark as
inversion and trailing slashes to match only directories.
Sourcepub fn matches_mode(&self, file_mode: u32) -> bool
pub fn matches_mode(&self, file_mode: u32) -> bool
Test this entry’s file type restrictions against a file mode retrieved from stat()
.
Sourcepub fn matches_path_suffix<T: AsRef<[u8]>>(&self, path: T) -> bool
pub fn matches_path_suffix<T: AsRef<[u8]>>(&self, path: T) -> bool
Test whether this entry’s pattern matches any complete suffix of a path.
For the path /foo/bar/baz
, this tests whether baz
, bar/baz
or foo/bar/baz
is
matched.
Sourcepub fn matches_path_exact<T: AsRef<[u8]>>(&self, path: T) -> bool
pub fn matches_path_exact<T: AsRef<[u8]>>(&self, path: T) -> bool
Test whether this entry’s pattern matches a path exactly.
Trait Implementations§
Source§impl Clone for MatchEntry
impl Clone for MatchEntry
Source§fn clone(&self) -> MatchEntry
fn clone(&self) -> MatchEntry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more