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§
- Case
Insensitive - The default pattern but with case insensitive matching.
- Default
Pattern Config - The default pattern.
- Error
- Pattern parsing error.
- Pattern
Patternrepresents a successfully parsed Relay pattern.- Pattern
Builder - A builder for a
Pattern. - Patterns
- A collection of
Patterns sharing the same configuration. - Patterns
Builder - A builder for a collection of
Patterns. - Patterns
Builder Configured - A
PatternsBuilderwith all options configured. - Typed
Pattern - A
Patternwith compile time encodedPatternConfig. - Typed
Patterns Patternswith a compile time configuredPatternConfig.- Typed
Patterns Builder
Traits§
- Pattern
Config - Compile time configuration for a
TypedPattern.