1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// License: see LICENSE file at root directory of `master` branch

//! # An implementation of <https://semver.org>
//!
//! # Project
//!
//! - Reporisoty: <https://bitbucket.org/haibison/cl_semver>
//! - License: [Free Public License 1.0.0](https://opensource.org/licenses/FPL-1.0.0)
//!
//! # Features
//!
//! - Supporting [2.0.0 specification](https://semver.org/spec/v2.0.0.html).
//! - Parsing data from: [`String`][std::string::String], [`&str`][primitive::str], [`OsString`][std::ffi::OsString],
//!   [`&OsStr`][std::ffi::OsStr], [`CString`][std::ffi::CString], [`&CStr`][std::ffi::CStr].
//! - Tolerant parser: leading/trailing white spaces are ignored; minor and patch version numbers are optional. This parser is added
//!   by the crate author, and is not described in official specification. See [`Semver`] for more details.
//! - Handy functions: [`is_stable()`][Semver.is_stable()], [`is_early()`][Semver.is_early()],
//!   [`parse_pre_release()`][Semver.parse_pre_release()], [`new_major()`][Semver.new_major()], [`new_minor()`][Semver.new_minor()],
//!   [`new_patch()`][Semver.new_patch()]...
//!
//! [std::string::String]: https://doc.rust-lang.org/std/string/struct.String.html
//! [std::ffi::CStr]: https://doc.rust-lang.org/std/ffi/struct.CStr.html
//! [std::ffi::CString]: https://doc.rust-lang.org/std/ffi/struct.CString.html
//! [std::ffi::OsStr]: https://doc.rust-lang.org/std/ffi/struct.OsStr.html
//! [std::ffi::OsString]: https://doc.rust-lang.org/std/ffi/struct.OsString.html
//! [primitive::str]: https://doc.rust-lang.org/std/primitive.str.html
//! [`Semver`]: struct.Semver.html
//! [Semver.is_stable()]: struct.Semver.html#method.is_stable
//! [Semver.is_early()]: struct.Semver.html#method.is_early
//! [Semver.parse_pre_release()]: struct.Semver.html#method.parse_pre_release
//! [Semver.new_major()]: struct.Semver.html#method.new_major
//! [Semver.new_minor()]: struct.Semver.html#method.new_minor
//! [Semver.new_patch()]: struct.Semver.html#method.new_patch

// ╔═════════════════╗
// ║   IDENTIFIERS   ║
// ╚═════════════════╝

macro_rules! crate_code_name {
    () => {
        "dia-semver"
    }
}

macro_rules! crate_version_name {
    () => {
        "0.2.0"
    }
}

/// # Crate name.
pub const CRATE_NAME: &'static str = "Dia-semver";

/// # Crate code name.
pub const CRATE_CODE_NAME: &'static str = crate_code_name!();

/// # Crate version name.
pub const CRATE_VERSION_NAME: &'static str = crate_version_name!();

/// # Crate release date (year/month/day).
pub const CRATE_RELEASE_DATE: [u16; 3] = [2018, 4, 21];

/// # Unique universally identifier of this crate. Its CRC-32 is `d3a031f3`.
pub const UUID: &'static str = "d2cf0a14-19be-4aab-802a-bdc7caf7dc65";

/// # Tag, which can be used for logging...
pub const TAG: &'static str = concat!(crate_code_name!(), "_d3a031f3_", crate_version_name!());

// ╔════════════════════╗
// ║   IMPLEMENTATION   ║
// ╚════════════════════╝

mod semver;
pub use semver::Semver;
pub use semver::PreRelease;
pub use semver::ParseSemverError;
pub use semver::SemverErrorKind;