pub trait Program<'t>: Pattern<'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§
sourcefn is_match<'p>(&self, path: impl Into<CandidatePath<'p>>) -> bool
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.
sourcefn matched<'p>(&self, path: &'p CandidatePath<'_>) -> Option<MatchedText<'p>>
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.
sourcefn variance(&self) -> Variance
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.
sourcefn is_exhaustive(&self) -> bool
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/<<?>/>*.