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) -> Prerelease
impl Debug for Prerelease
fn fmt(&self, formatter: &mut Formatter<'_>) -> Result
impl Default for Prerelease
fn default() -> Prerelease
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: &Prerelease) -> bool
impl PartialOrd for Prerelease
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
impl StructuralPartialEq for Prerelease
Auto Trait Implementations
impl Freeze for Prerelease
impl RefUnwindSafe for Prerelease
impl Send for Prerelease
impl Sync for Prerelease
impl Unpin for Prerelease
impl UnsafeUnpin for Prerelease
impl UnwindSafe for Prerelease
Blanket Implementations
impl<P, T> Receiver for Prerelease
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for Prerelease
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Prerelease
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Prerelease
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Prerelease
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Prerelease
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Prerelease
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> ToString for Prerelease
where
T: Display + ?Sized,
fn to_string(&self) -> String
impl<T, U> Into<U> for Prerelease
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Prerelease
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Prerelease
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>