pub struct Mess {
pub chunks: Vec<MChunk>,
pub next: Option<(Sep, Box<Mess>)>,
}Expand description
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, Chunk 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 Mess::nth.
In general this is not guaranteed to have well-defined ordering behaviour,
but existing tests show sufficient consistency. Mess::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>The first section of a Mess.
next: Option<(Sep, Box<Mess>)>The rest of the Mess.
Implementations§
source§impl Mess
impl Mess
sourcepub fn nth(&self, x: usize) -> Option<u32>
pub fn nth(&self, x: usize) -> Option<u32>
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§
source§impl Ord for Mess
impl Ord for Mess
Build metadata does not affect version precendence, and pre-release versions have lower precedence than normal versions.
source§impl PartialEq for Mess
impl PartialEq for Mess
source§impl PartialOrd for Mess
impl PartialOrd for Mess
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read more