Skip to content

Commit 4cd6372

Browse files
committed
---
yaml --- r: 83331 b: refs/heads/try c: a5cf9fd h: refs/heads/master i: 83329: fb67f32 83327: a07e49f v: v3
1 parent 3d47fe8 commit 4cd6372

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 33e913d9cfa2519993740bbbea592697f3aa950d
5+
refs/heads/try: a5cf9fdb61432ea0182dc250305332f3a2d6f214
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libextra/semver.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,25 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Semver parsing and logic
12-
13-
#[allow(missing_doc)];
14-
11+
//! Semantic version parsing and comparison.
12+
//!
13+
//! Semantic versioning (see http://semver.org/) is a set of rules for
14+
//! assigning version numbers intended to convey meaning about what has
15+
//! changed, and how much. A version number has five parts:
16+
//!
17+
//! * Major number, updated for incompatible API changes
18+
//! * Minor number, updated for backwards-compatible API additions
19+
//! * Patch number, updated for backwards-compatible bugfixes
20+
//! * Pre-release information (optional), preceded by a hyphen (`-`)
21+
//! * Build metadata (optional), preceded by a plus sign (`+`)
22+
//!
23+
//! The three mandatory components are required to be decimal numbers. The
24+
//! pre-release information and build metadata are required to be a
25+
//! period-separated list of identifiers containing only alphanumeric
26+
//! characters and hyphens.
27+
//!
28+
//! An example version number with all five components is
29+
//! `0.8.1-rc.3.0+20130922.linux`.
1530
1631
use std::char;
1732
use std::cmp;
@@ -20,6 +35,8 @@ use std::io;
2035
use std::option::{Option, Some, None};
2136
use std::to_str::ToStr;
2237

38+
/// An identifier in the pre-release or build metadata. If the identifier can
39+
/// be parsed as a decimal value, it will be represented with `Numeric`.
2340
#[deriving(Clone, Eq)]
2441
pub enum Identifier {
2542
Numeric(uint),
@@ -49,12 +66,20 @@ impl ToStr for Identifier {
4966
}
5067

5168

69+
/// Represents a version number conforming to the semantic versioning scheme.
5270
#[deriving(Clone, Eq)]
5371
pub struct Version {
72+
/// The major version, to be incremented on incompatible changes.
5473
major: uint,
74+
/// The minor version, to be incremented when functionality is added in a
75+
/// backwards-compatible manner.
5576
minor: uint,
77+
/// The patch version, to be incremented when backwards-compatible bug
78+
/// fixes are made.
5679
patch: uint,
80+
/// The pre-release version identifier, if one exists.
5781
pre: ~[Identifier],
82+
/// The build metadata, ignored when determining version precedence.
5883
build: ~[Identifier],
5984
}
6085

@@ -202,6 +227,7 @@ fn parse_reader(rdr: @io::Reader) -> Version {
202227
}
203228

204229

230+
/// Parse a string into a semver object.
205231
pub fn parse(s: &str) -> Option<Version> {
206232
if !s.is_ascii() {
207233
return None;

0 commit comments

Comments
 (0)