pub enum Variance {
Invariant(PathBuf),
Variant,
}
Expand description
Variance of a Program
.
The variance of a pattern describes the kinds of paths it can match with respect to the
platform file system APIs. Program
s are either variant or invariant.
An invariant Program
can be represented and completely described by an equivalent path
using the platform’s file system APIs. For example, the glob expression path/to/file.txt
resolves identically to the paths path/to/file.txt
and path\to\file.txt
on Unix and
Windows, respectively.
A variant Program
resolves differently than any particular path used with the platform’s
file system APIs. Such an expression cannot be represented by a single path. This is typically
because the expression matches multiple texts using a regular pattern, such as in the glob
expression **/*.rs
.
Variants§
Invariant(PathBuf)
Tuple Fields
A Program
is invariant and equivalent to a path.
Some non-literal expressions may be invariant, such as in the expression
path/[t][o]/{file,file}.txt
, which is invariant on Unix (but not on Windows, because the
character class expressions do not match with case folding).
Variant
A Program
is variant and cannot be completely described by a path.
Variant expressions may be formed from literals or other seemingly invariant
expressions. For example, the variance of literals considers the case sensitivity of the
platform’s file system APIs, so the expression (?i)path/to/file.txt
is variant on Unix
but not on Windows. Similarly, the expression path/[t][o]/file.txt
is variant on Windows
but not on Unix.