Struct MatchEntry

Source
pub struct MatchEntry { /* private fields */ }
Expand description

A single entry in a MatchList.

Implementations§

Source§

impl MatchEntry

Source

pub fn new<T: Into<MatchPattern>>(pattern: T, ty: MatchType) -> Self

Create a new match entry.

Source

pub fn include<T: Into<MatchPattern>>(pattern: T) -> Self

Create a new include-type match entry with default flags.

Source

pub fn exclude<T: Into<MatchPattern>>(pattern: T) -> Self

Create a new exclude-type match entry with default flags.

Source

pub fn flags(self, flags: MatchFlag) -> Self

Builder method to set the match flags to a specific value.

Source

pub fn add_flags(self, flags: MatchFlag) -> Self

Builder method to add flag bits to the already present ones.

Source

pub fn remove_flags(self, flags: MatchFlag) -> Self

Builder method to remove match flag bits.

Source

pub fn toggle_flags(self, flags: MatchFlag) -> Self

Builder method to toggle flag bits.

Source

pub fn match_type(&self) -> MatchType

Source

pub fn match_type_mut(&mut self) -> &mut MatchType

Non-Builder method to change the match type.

Source

pub fn pattern(&self) -> &MatchPattern

Directly access the pattern.

Source

pub fn pattern_mut(&mut self) -> &mut MatchPattern

Non-Builder method to change the pattern.

Source

pub fn match_flags(&self) -> MatchFlag

Directly access the match flags.

Source

pub fn match_flags_mut(&mut self) -> &mut MatchFlag

Non-Builder method to change the flags.

Source

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.

Source

pub fn matches_mode(&self, file_mode: u32) -> bool

Test this entry’s file type restrictions against a file mode retrieved from stat().

Source

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.

Source

pub fn matches_path_exact<T: AsRef<[u8]>>(&self, path: T) -> bool

Test whether this entry’s pattern matches a path exactly.

Source

pub fn matches<T: AsRef<[u8]>>(&self, path: T, file_mode: Option<u32>) -> bool

Check whether the path contains a matching suffix and the file mode match the expected file modes. This is a combination of using .matches_mode() and .matches_path_suffix().

Source

pub fn matches_exact<T: AsRef<[u8]>>( &self, path: T, file_mode: Option<u32>, ) -> bool

Check whether the path contains a matching suffix and the file mode match the expected file modes. This is a combination of using .matches_mode() and .matches_path_exact().

Trait Implementations§

Source§

impl Clone for MatchEntry

Source§

fn clone(&self) -> MatchEntry

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MatchEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.