globlin
Types
pub type PatternError {
AbsolutePatternFromDirError
InvalidGlobStarError
MissingClosingBracketError
}
Constructors
-
AbsolutePatternFromDirError
- The pattern must NOT start with a slash if compiled with a directory prefix.
-
InvalidGlobStarError
- The globstar (“**”) must always appear between the end of a string and/or a slash.
-
MissingClosingBracketError
- A char set or range was opened but never closed.
Options that can be provided to the new_pattern_with
method.
- ignore_case: All matching is case insensitive (Default: False)
- match_dotfiles: Match dotfiles when using wildcards (Default: False)
pub type PatternOptions {
PatternOptions(ignore_case: Bool, match_dotfiles: Bool)
}
Constructors
-
PatternOptions(ignore_case: Bool, match_dotfiles: Bool)
Functions
pub fn match_pattern(
pattern pattern: Pattern,
path path: String,
) -> Bool
Compare a Pattern
against a path to see if they match.
pub fn new_pattern(
pattern: String,
) -> Result(Pattern, PatternError)
Compile a Pattern
from a pattern.
pub fn new_pattern_with(
pattern: String,
from directory: String,
with options: PatternOptions,
) -> Result(Pattern, PatternError)
Compile a Pattern
from a directory, pattern and options.
The directory is escaped and prefixed before the pattern.