mirror of
https://git.proxmox.com/git/pathpatterns
synced 2025-07-13 18:24:49 +00:00
MatchEntry: also provide access to other parts
In the future we'll probably have a separate Builder type, but that's an API change. Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
ed626f3831
commit
8e38a91c57
@ -148,18 +148,33 @@ impl MatchEntry {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn match_type(&self) -> MatchType {
|
||||||
|
self.ty
|
||||||
|
}
|
||||||
|
|
||||||
/// Non-Builder method to change the match type.
|
/// Non-Builder method to change the match type.
|
||||||
pub fn match_type_mut(&mut self) -> &mut MatchType {
|
pub fn match_type_mut(&mut self) -> &mut MatchType {
|
||||||
&mut self.ty
|
&mut self.ty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Directly access the pattern.
|
||||||
|
pub fn pattern(&self) -> &MatchPattern {
|
||||||
|
&self.pattern
|
||||||
|
}
|
||||||
|
|
||||||
/// Non-Builder method to change the pattern.
|
/// Non-Builder method to change the pattern.
|
||||||
pub fn pattern_mut(&mut self) -> &mut MatchPattern {
|
pub fn pattern_mut(&mut self) -> &mut MatchPattern {
|
||||||
&mut self.pattern
|
&mut self.pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Directly access the match flags.
|
||||||
|
pub fn match_flags(&mut self) -> MatchFlag {
|
||||||
|
self.flags
|
||||||
|
}
|
||||||
|
|
||||||
/// Non-Builder method to change the flags.
|
/// Non-Builder method to change the flags.
|
||||||
pub fn flags_mut(&mut self) -> &mut MatchFlag {
|
pub fn match_flags_mut(&mut self) -> &mut MatchFlag {
|
||||||
&mut self.flags
|
&mut self.flags
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,11 +208,6 @@ impl MatchEntry {
|
|||||||
Ok(Self::new(crate::Pattern::new(pattern, pattern_flags)?, ty).flags(flags))
|
Ok(Self::new(crate::Pattern::new(pattern, pattern_flags)?, ty).flags(flags))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
|
||||||
pub fn match_type(&self) -> MatchType {
|
|
||||||
self.ty
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Test this entry's file type restrictions against a file mode retrieved from `stat()`.
|
/// Test this entry's file type restrictions against a file mode retrieved from `stat()`.
|
||||||
pub fn matches_mode(&self, file_mode: u32) -> bool {
|
pub fn matches_mode(&self, file_mode: u32) -> bool {
|
||||||
// bitflags' `.contains` means ALL bits must be set, if they are all set we don't
|
// bitflags' `.contains` means ALL bits must be set, if they are all set we don't
|
||||||
|
Loading…
Reference in New Issue
Block a user