[−][src]Struct versions::Mess
A complex version number with no specific structure.
Like Version this is a descriptive scheme, but it
is based on examples of stupidly crafted, near-lawless version numbers used
in the wild. Versions like this are a considerable burden to package
management software.
With Mess, groups of letters/numbers are separated by a period, but can be
further separated by the symbols _-+:.
Unfortunately, Chunks cannot be used here, as some
developers have numbers like 1.003.04 which make parsers quite sad.
Some Mess values have a shape that is tantalizingly close to a
SemVer. Example: 1.6.0a+2014+m872b87e73dfb-1. For
values like these, we can extract the SemVer-compatible values out with
nth.
In general this is not guaranteed to have well-defined ordering behaviour,
but existing tests show sufficient consistency. nth is used
internally where appropriate to enhance accuracy.
Examples
use versions::{Mess, SemVer, Version}; let mess = "20.0026.1_0-2+0.93"; let s = SemVer::new(mess); let v = Version::new(mess); let m = Mess::new(mess); assert!(s.is_none()); assert!(v.is_none()); assert_eq!(Some(mess.to_string()), m.map(|v| format!("{}", v)));
Fields
chunks: Vec<MChunk>next: Option<(Sep, Box<Mess>)>Implementations
impl Mess[src]
pub fn new(s: &str) -> Option<Mess>[src]
Parse a Mess from some input.
pub fn nth(&self, x: usize) -> Option<u32>[src]
Try to extract a position from the Mess as a nice integer, as if it
were a SemVer.
use versions::Mess; let mess = Mess::new("1.6a.0+2014+m872b87e73dfb-1").unwrap(); assert_eq!(Some(1), mess.nth(0)); assert_eq!(None, mess.nth(1)); assert_eq!(Some(0), mess.nth(2));
Trait Implementations
impl Clone for Mess[src]
impl Debug for Mess[src]
impl Display for Mess[src]
impl Eq for Mess[src]
impl Hash for Mess[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 Mess[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<Mess> for Mess[src]
impl PartialOrd<Mess> for Mess[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 Mess[src]
impl StructuralPartialEq for Mess[src]
Auto Trait Implementations
impl RefUnwindSafe for Mess
impl Send for Mess
impl Sync for Mess
impl Unpin for Mess
impl UnwindSafe for Mess
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>,