Struct semver::Prerelease [−][src]
pub struct Prerelease { /* fields omitted */ }
Expand description
Optional pre-release identifier on a version string. This comes after -
in
a SemVer version, like 1.0.0-alpha.1
Examples
Some real world pre-release idioms drawn from crates.io:
-
mio
0.7.0-alpha.1
— the most common style for numbering pre-releases. -
pest
1.0.0-beta.8
,1.0.0-rc.0
— this crate makes a distinction between betas and release candidates. -
sassers
0.11.0-shitshow
— ???. -
atomic-utils
0.0.0-reserved
— a squatted crate name.
Tip: Be aware that if you are planning to number your own pre-releases,
you should prefer to separate the numeric part from any non-numeric
identifiers by using a dot in between. That is, prefer pre-releases
alpha.1
, alpha.2
, etc rather than alpha1
, alpha2
etc. The SemVer
spec’s rule for pre-release precedence has special treatment of numeric
components in the pre-release string, but only if there are no non-digit
characters in the same dot-separated component. So you’d have alpha.2
<
alpha.11
as intended, but alpha11
< alpha2
.
Syntax
Pre-release strings are a series of dot separated identifiers immediately
following the patch version. Identifiers must comprise only ASCII
alphanumerics and hyphens: 0-9
, A-Z
, a-z
, -
. Identifiers must not be
empty. Numeric identifiers must not include leading zeros.
Total ordering
Pre-releases have a total order defined by the SemVer spec. It uses lexicographic ordering of dot-separated components. Identifiers consisting of only digits are compared numerically. Otherwise, identifiers are compared in ASCII sort order. Any numeric identifier is always less than any non-numeric identifier.
Example: alpha
< alpha.85
< alpha.90
< alpha.200
< alpha.0a
< alpha.1a0
< alpha.a
< beta
Implementations
Trait Implementations
Returns the “default value” for a type. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Prerelease
impl Send for Prerelease
impl Sync for Prerelease
impl Unpin for Prerelease
impl UnwindSafe for Prerelease
Blanket Implementations
Mutably borrows from an owned value. Read more