Skip to main content

gitversion_rs/version/
mod.rs

1//! Version data model and calculation engine.
2
3pub mod calculation;
4pub mod semver;
5
6pub use semver::{BuildMetaData, PreReleaseTag, SemanticVersion};
7
8/// Version field to increment. Corresponds to `GitVersion.Core/SemVer/VersionField.cs`.
9///
10/// Sort order is also priority: `None < Patch < Minor < Major`.
11#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default)]
12pub enum VersionField {
13    #[default]
14    None,
15    Patch,
16    Minor,
17    Major,
18}
19
20impl VersionField {
21    pub fn as_str(&self) -> &'static str {
22        match self {
23            VersionField::None => "None",
24            VersionField::Patch => "Patch",
25            VersionField::Minor => "Minor",
26            VersionField::Major => "Major",
27        }
28    }
29}