VersionReq
SemVer version requirement describing the intersection of some version comparators, such as >=1.2.3, <1.8
.
Spec: https://docs.rs/semver/1.0.20/semver/struct.VersionReq.html
Properties
comparators
This item is read only and cannot be modified. Read OnlySTAR
This item is read only and cannot be modified. Read OnlyStaticVersionReq.STAR:
VersionReq
A VersionReq
with no constraint on the version numbers it matches. Equivalent to VersionReq.parse("*")
.
In terms of comparators this is equivalent to >=0.0.0
.
Counterintuitively a *
VersionReq does not match every possible version number. In particular, in order for any VersionReq
to match a pre-release version, the VersionReq
must contain at least one Comparator that has an explicit major, minor, and patch version identical to the pre-release being matched, and that has a nonempty pre-release component. Since *
is not written with an explicit major, minor, and patch version, and does not contain a nonempty pre-release component, it does not match any pre-release versions.
Functions
parse
Possible reasons for the parse to fail include:
Errors
Type | Description |
---|---|
UnexpectedChar (">a.b") | unexpected characters in the partial version. |
UnexpectedChar ("@1.0.0) | unrecognized comparison operator. |
UnexpectedEnd ("^1.0.0,") | unexpected end of input. |
ExpectedCommaFound (">=1.0 <2.0") | missing comma between comparators. |
UnexpectedAfterWildcard ("*.*") | unsupported wildcard syntax. |
is
VersionReq.
is
(
obj:
any
) →
boolean
Returns true
if obj
is a VersionReq.
matches
Evaluate whether the given Version satisfies the version requirement described by self
.
__tostring
VersionReq:
__tostring
(
) →
string
This metamethod transforms self
into a string.
__eq
This metamethod tests for self
and other
values to be equal and is used by the operators ==
and ~=
.