Enum next_version::VersionIncrement
source · pub enum VersionIncrement {
Major,
Minor,
Patch,
Prerelease,
}Variants§
Implementations§
source§impl VersionIncrement
impl VersionIncrement
sourcepub fn from_commits<I>(current_version: &Version, commits: I) -> Option<Self>where
I: IntoIterator,
I::Item: AsRef<str>,
pub fn from_commits<I>(current_version: &Version, commits: I) -> Option<Self>where I: IntoIterator, I::Item: AsRef<str>,
Analyze commits and determine which part of version to increment based on conventional commits and Semantic versioning.
- If no commits are present,
Option::Noneis returned, because the version should not be incremented. - If some commits are present and
semver::Prereleaseis not empty, the version increment isVersionIncrement::Prerelease. - If some commits are present, but none of them match conventional commits specification,
the version increment is
VersionIncrement::Patch. - If some commits match conventional commits, then the next version is calculated by using these rules.
sourcepub fn breaking(current_version: &Version) -> Self
pub fn breaking(current_version: &Version) -> Self
Increments the version to take into account breaking changes.
use next_version::VersionIncrement;
use semver::Version;
let increment = VersionIncrement::breaking(&Version::new(0, 3, 3));
assert_eq!(increment, VersionIncrement::Minor);
let increment = VersionIncrement::breaking(&Version::new(1, 3, 3));
assert_eq!(increment, VersionIncrement::Major);
let increment = VersionIncrement::breaking(&Version::parse("1.3.3-alpha.1").unwrap());
assert_eq!(increment, VersionIncrement::Prerelease);Trait Implementations§
source§impl Debug for VersionIncrement
impl Debug for VersionIncrement
source§impl PartialEq<VersionIncrement> for VersionIncrement
impl PartialEq<VersionIncrement> for VersionIncrement
source§fn eq(&self, other: &VersionIncrement) -> bool
fn eq(&self, other: &VersionIncrement) -> bool
This method tests for
self and other values to be equal, and is used
by ==.