Trait wax::Pattern

source ·
pub trait Pattern<'t>: Combine<'t, Error = Infallible> {
    // Required methods
    fn is_match<'p>(&self, path: impl Into<CandidatePath<'p>>) -> bool;
    fn matched<'p>(
        &self,
        path: &'p CandidatePath<'_>
    ) -> Option<MatchedText<'p>>;
    fn variance(&self) -> Variance;
    fn is_exhaustive(&self) -> bool;
}
Expand description

A compiled glob expression that can be inspected and matched against paths.

Matching is a logical operation and does not interact with a file system. To handle path operations, use Path and/or PathBuf and their associated functions. See Glob::partition for more about globs and path operations.

Required Methods§

source

fn is_match<'p>(&self, path: impl Into<CandidatePath<'p>>) -> bool

Returns true if a path matches the pattern.

The given path must be convertible into a CandidatePath.

source

fn matched<'p>(&self, path: &'p CandidatePath<'_>) -> Option<MatchedText<'p>>

Gets matched text in a CandidatePath.

Returns None if the CandidatePath does not match the pattern.

source

fn variance(&self) -> Variance

Gets the variance of the pattern.

The variance of a pattern describes the kinds of paths it can match with respect to the platform file system APIs.

source

fn is_exhaustive(&self) -> bool

Returns true if the pattern is exhaustive.

A glob expression is exhaustive if its terminating component matches any and all sub-trees, such as in the expressions /home/** and local/<<?>/>*.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'t> Pattern<'t> for Any<'t>

source§

impl<'t> Pattern<'t> for Glob<'t>