Matcher

Struct Matcher 

Source
pub struct Matcher<'a, P>
where P: AsRef<Path>,
{ /* private fields */ }
Expand description

Matcher type for transformation into an iterator.

This type exists such that Builder::build can return a result type (whereas into_iter cannot). Notice that iter() is not implemented due to the use of references.

Implementations§

Source§

impl<'a, P> Matcher<'a, P>
where P: AsRef<Path>,

Source

pub fn glob(&self) -> &str

Provides the original glob-pattern used to create this Matcher.

This is the unchanged glob, i.e., no relative path components have been resolved.

Source

pub fn root(&self) -> String

Provides the resolved root folder used by the Matcher.

This directory already contains the path components from the original glob. The main intention of this function is to for debugging or logging (thus a String).

Source

pub fn rest(&self) -> &str

Provides the resolved glob used by the Matcher.

All relative path components have been resolved for this glob. The glob is of type &str since all globs are input parameters and specified as strings (and not paths).

Source

pub fn is_match(&self, p: P) -> bool

Checks whether the provided path is a match for the stored glob.

Trait Implementations§

Source§

impl<'a, P> Debug for Matcher<'a, P>
where P: AsRef<Path> + Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, P> IntoIterator for Matcher<'a, P>
where P: AsRef<Path>,

Source§

fn into_iter(self) -> Self::IntoIter

Transform the Matcher into a recursive directory iterator.

Source§

type Item = Result<PathBuf, Error>

The type of the elements being iterated over.
Source§

type IntoIter = IterAll<P>

Which kind of iterator are we turning this into?

Auto Trait Implementations§

§

impl<'a, P> Freeze for Matcher<'a, P>
where P: Freeze,

§

impl<'a, P> RefUnwindSafe for Matcher<'a, P>
where P: RefUnwindSafe,

§

impl<'a, P> Send for Matcher<'a, P>
where P: Send,

§

impl<'a, P> Sync for Matcher<'a, P>
where P: Sync,

§

impl<'a, P> Unpin for Matcher<'a, P>
where P: Unpin,

§

impl<'a, P> UnwindSafe for Matcher<'a, P>
where P: UnwindSafe,

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> 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, 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.