Crate relay_pattern
source ·Expand description
A glob like pattern used throught Relay and its APIs.
§Behaviour
A pattern is similar to a glob but without support for brace expansions and without any support for filesystem specific behaviour like platform dependent separators and file extension matching.
By default a Pattern
does not support any separator characters.
For example *
usually only matches up to the next path separator (often platform dependent),
in a Pattern
*
matches all characters. Optional support for a single separator character
is available.
The empty glob ""
never matches.
§Syntax
Basic glob like syntax is supported with Unix style negations.
?
matches any single character.*
matches any number of any characters, including none.[abc]
matches one character in the given bracket.[!abc]
matches one character that is not in the given bracket.[a-z]
matches one character in the given range.[!a-z]
matches one character that is not in the given range.{a,b}
matches any pattern within the alternation group.\
escapes any of the above special characters and treats it as a literal.
§Complexity
Patterns can be limited to a maximum complexity using PatternBuilder::max_complexity
.
Complexity of a pattern is calculated by the amount of possible combinations created with
alternations.
For example, the pattern {foo,bar}
has a complexity of 2, the pattern {foo,bar}/{*.html,*.js,*.css}
has a complexity of 2 * 3
.
For untrusted user input it is highly recommended to limit the maximum complexity.
Structs§
- The default pattern but with case insensitive matching.
- The default pattern.
- Pattern parsing error.
Pattern
represents a successfully parsed Relay pattern.- A builder for a
Pattern
. - A collection of
Pattern
s sharing the same configuration. - A builder for a collection of
Patterns
. - A
PatternsBuilder
with all options configured. - A
Pattern
with compile time encodedPatternConfig
. Patterns
with a compile time configuredPatternConfig
.
Traits§
- Compile time configuration for a
TypedPattern
.