oci_spec/distribution/
version.rs

1use const_format::formatcp;
2
3/// API incompatible changes.
4pub const VERSION_MAJOR: u32 = 1;
5
6/// Changing functionality in a backwards-compatible manner
7pub const VERSION_MINOR: u32 = 0;
8
9/// Backwards-compatible bug fixes.
10pub const VERSION_PATCH: u32 = 0;
11
12/// Indicates development branch. Releases will be empty string.
13pub const VERSION_DEV: &str = "";
14
15/// Retrieve the version as static str representation.
16pub const VERSION: &str = formatcp!("{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_PATCH}{VERSION_DEV}");
17
18/// Retrieve the version as string representation.
19///
20/// Use [`VERSION`] instead.
21#[deprecated]
22pub fn version() -> String {
23    VERSION.to_owned()
24}
25
26#[cfg(test)]
27mod tests {
28    use super::*;
29
30    #[test]
31    #[allow(deprecated)]
32    fn version_test() {
33        assert_eq!(version(), "1.0.0".to_string())
34    }
35}