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
//! Metadata about the Neon version and build.

use semver::Version;

/// The Neon version.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");

/// The Neon major version.
pub const MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");

/// The Neon minor version.
pub const MINOR: &str = env!("CARGO_PKG_VERSION_MINOR");

/// The Neon patch version.
pub const PATCH: &str = env!("CARGO_PKG_VERSION_PATCH");

/// Produces a `semver::Version` data structure representing the Neon version.
pub fn version() -> Version {
    Version {
        major: MAJOR.parse().unwrap(),
        minor: MINOR.parse().unwrap(),
        patch: PATCH.parse().unwrap(),
        pre: vec![],
        build: vec![],
    }
}

// We captured the build profile from build.rs and saved it in the cfg variable `neon_profile`.

/// The current build profile (either `"release"` or `"debug"`).
#[cfg(neon_profile = "release")]
pub const BUILD_PROFILE: &str = "release";

/// The current build profile (either `"release"` or `"debug"`).
#[cfg(not(neon_profile = "release"))]
pub const BUILD_PROFILE: &str = "debug";