Newest version of the proposal is here: http://discuss.rust-lang.org/t/stabilizing-semver/376/15?u=steveklabnik
I haven’t ever done this before, so all of this is extremely preliminary.
SemVer is a tiny crate, and I think we can make it stable. I’d even expect SemVer to become the first crate ever to be locked, but let’s not jump the gun here.
SemVer has only three public things: an enum with two variants, a struct, and a function. Easy.
pub enum Identifier {
Numeric(uint),
AlphaNumeric(String)
}
I think this is good, with one small reservation: we’ve been moving away from int
/uint
, and so I wonder if this shouldn’t be a u32
instead.
pub struct Version {
pub major: uint,
pub minor: uint,
pub patch: uint,
pub pre: Vec<Identifier>,
pub build: Vec<Identifier>,
}
This is the same. Seems good, but maybe u32
is more appropriate.
pub fn parse(s: &str) -> Option<Version> {
This interface seems perfectly acceptable to me. I can’t think of a better one.
I do have some concerns making it stable
immediately though, since nothing in the compiler itself actually depends on SemVer. Given that Cargo does, I would recommend, pending uint
/u32
questions, that we move all of SemVer to ‘unstable’, pending some more real-world testing.
Thoughts?