[−][src]Struct versions::SemVer
An ideal version number that conforms to Semantic Versioning.
This is a prescriptive scheme, meaning that it follows the SemVer standard.
Legal semvers are of the form: MAJOR.MINOR.PATCH-PREREL+META
- Simple Sample:
1.2.3 - Full Sample:
1.2.3-alpha.2+a1b2c3.1
Extra Rules
- Pre-release versions have lower precedence than normal versions.
- Build metadata does not affect version precedence.
- PREREL and META strings may only contain ASCII alphanumerics.
Examples
use versions::SemVer; let orig = "1.2.3-r1+git"; let attempt = SemVer::new(orig).unwrap(); assert_eq!(orig, format!("{}", attempt));
Fields
major: u32minor: u32patch: u32pre_rel: Option<Chunks>Some implies that the inner Vec of the Chunks is not empty.
meta: Option<Chunks>Some implies that the inner Vec of the Chunks is not empty.
Implementations
impl SemVer[src]
pub fn new(s: &str) -> Option<SemVer>[src]
Parse a SemVer from some input.
pub fn to_version(&self) -> Version[src]
A lossless conversion from SemVer to Version.
Note: Unlike SemVer, Version expects its metadata before the
prerelease. For instance:
use versions::SemVer; let orig = "1.2.3-r1+git123"; let ver = SemVer::new(orig).unwrap().to_version(); assert_eq!("1.2.3+git123-r1", format!("{}", ver));
pub fn to_mess(&self) -> Mess[src]
A lossless conversion from SemVer to Mess.
use versions::SemVer; let orig = "1.2.3-r1+git123"; let mess = SemVer::new(orig).unwrap().to_mess(); assert_eq!(orig, format!("{}", mess));
Trait Implementations
impl Clone for SemVer[src]
impl Debug for SemVer[src]
impl Display for SemVer[src]
impl Eq for SemVer[src]
impl Hash for SemVer[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl Ord for SemVer[src]
Build metadata does not affect version precendence, and pre-release versions have lower precedence than normal versions.
fn cmp(&self, other: &Self) -> Ordering[src]
#[must_use]fn max(self, other: Self) -> Self1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self[src]
impl PartialEq<SemVer> for SemVer[src]
Two SemVers are equal if all fields except metadata are equal.
impl PartialOrd<SemVer> for SemVer[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for SemVer[src]
Auto Trait Implementations
impl RefUnwindSafe for SemVer
impl Send for SemVer
impl Sync for SemVer
impl Unpin for SemVer
impl UnwindSafe for SemVer
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,