GlobSet
A list of glob patterns with exclusions: a string matches when one pattern matches and no
exclusion does, like the lines of a .gitignore read the other way round.
Patterns use the * and ? of match_glob, which is case-sensitive. A pattern starting
with ! is an exclusion; write \! for a pattern that really starts with !. The order does
not matter. With no pattern besides exclusions, everything else matches, and an empty set
matches everything (no filter).
Regular expressions need a dependency this crate does not have; use the regex crate for
those, or the TypeScript package’s createMatcher.
Import
Section titled “Import”Cargo feature string (enabled by default). To compile only this module:
or in Cargo.toml:
Definition
Section titled “Definition”Examples
Section titled “Examples”Methods
Section titled “Methods”Builds a set from patterns, ! marking the exclusions.
Parameters
| Parameter | Type | Description |
|---|---|---|
patterns | &[&str] | The patterns, with ! before an exclusion and \! for a literal !. |
Returns
Self — The set.
Examples
is_match
Section titled “is_match”Whether text matches the set.
Parameters
| Parameter | Type | Description |
|---|---|---|
text | &str | The string to test. |
Returns
bool — true if one pattern matches and no exclusion does (or, with no pattern besides
exclusions, if no exclusion does).
Examples
