12 releases (7 breaking)

0.9.0 Jun 18, 2018
0.7.0 Feb 2, 2017
0.6.2 Jan 1, 2017
0.6.1 Sep 26, 2016
0.6.0 Jul 30, 2016

#2 in Parsing tools

Download history 22430/week @ 2018-07-20 21646/week @ 2018-07-27 24102/week @ 2018-08-03 22175/week @ 2018-08-10 19792/week @ 2018-08-17 20165/week @ 2018-08-24 20981/week @ 2018-08-31 21059/week @ 2018-09-07 35079/week @ 2018-09-14 37424/week @ 2018-09-21 36289/week @ 2018-09-28 39582/week @ 2018-10-05 36083/week @ 2018-10-12

80,117 downloads per month
Used in 2,144 crates (8 directly)

MIT/Apache

63KB
1.5K SLoC

semver-parser

Parsing for the semver spec.

We'll have better docs at 1.0.


lib.rs:

Collection of structures and helper functions for parsing semantic version.

This crate contains data structures for holding version data and comparison of versions according to Semantic versioning. Main structs are version::Version representing version itself and range::VersionReq as a collection of range::Predicate representing data for version comparison.

Examples

use semver_parser::range;
use semver_parser::version;

# fn try_main() -> Result<(), String> {
let r = range::parse("1.0.0")?;

assert_eq!(range::Predicate {
        op: range::Op::Compatible,
        major: 1,
        minor: Some(0),
        patch: Some(0),
        pre: Vec::new(),
    },
    r.predicates[0]
);

let m = version::parse("1.0.0")?;
for p in &r.predicates {
    match p.op {
        range::Op::Compatible => {
            assert_eq!(p.major, m.major);
        }
        _ => {
            unimplemented!();
        }
    }
}
# Ok(())
# }
#
# fn main() {
#   try_main().unwrap();
# }

No runtime deps