Struct Prerelease
pub struct Prerelease { /* private fields */ }
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
impl Prerelease
const EMPTY: Self = _;fn new(text: &str) -> Result<Self, Error>fn as_str(&self) -> &strfn is_empty(&self) -> bool
Trait Implementations
impl Clone for Prerelease
fn clone(&self) -> Self
impl Debug for Prerelease
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
impl Default for Prerelease
fn default() -> Self
impl Deref for Prerelease
type Target = str;fn deref(&self) -> &Self::Target
impl Display for Prerelease
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
impl Eq for Prerelease
impl FromStr for Prerelease
type Err = Error;fn from_str(text: &str) -> Result<Self, Self::Err>
impl Hash for Prerelease
fn hash<__H: Hasher>(&self, state: &mut __H)
impl Ord for Prerelease
fn cmp(&self, rhs: &Self) -> Ordering
impl PartialEq for Prerelease
fn eq(&self, other: &Self) -> bool
impl PartialOrd for Prerelease
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>