Struct Prerelease
struct Prerelease { ... }
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
fn new(text: &str) -> Result<Self, Error>fn as_str(self: &Self) -> &strfn is_empty(self: &Self) -> bool
impl Clone for Prerelease
fn clone(self: &Self) -> Prerelease
impl Debug for crate::Prerelease
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result
impl Default for Prerelease
fn default() -> Prerelease
impl Deref for crate::Prerelease
fn deref(self: &Self) -> &<Self as >::Target
impl Display for crate::Prerelease
fn fmt(self: &Self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result
impl Eq for Prerelease
impl Freeze for Prerelease
impl FromStr for crate::Prerelease
fn from_str(text: &str) -> Result<Self, <Self as >::Err>
impl Hash for Prerelease
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Ord for crate::Prerelease
fn cmp(self: &Self, rhs: &Self) -> Ordering
impl PartialEq for Prerelease
fn eq(self: &Self, other: &Prerelease) -> bool
impl PartialOrd for crate::Prerelease
fn partial_cmp(self: &Self, rhs: &Self) -> Option<Ordering>
impl RefUnwindSafe for Prerelease
impl Send for Prerelease
impl StructuralPartialEq for Prerelease
impl Sync for Prerelease
impl Unpin for Prerelease
impl UnwindSafe for Prerelease
impl<P, T> Receiver for Prerelease
impl<T> Any for Prerelease
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Prerelease
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Prerelease
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Prerelease
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Prerelease
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Prerelease
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Prerelease
fn to_string(self: &Self) -> String
impl<T, U> Into for Prerelease
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Prerelease
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Prerelease
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>