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 a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The resulting type after dereferencing.

Dereferences the value.

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.