Trait next_version::NextVersion
source · pub trait NextVersion {
// Required methods
fn next<I>(&self, commits: I) -> Self
where I: IntoIterator,
I::Item: AsRef<str>;
fn increment_major(&self) -> Self;
fn increment_minor(&self) -> Self;
fn increment_patch(&self) -> Self;
fn increment_prerelease(&self) -> Self;
}Required Methods§
fn next<I>(&self, commits: I) -> Selfwhere I: IntoIterator, I::Item: AsRef<str>,
sourcefn increment_major(&self) -> Self
fn increment_major(&self) -> Self
Increments the major version number.
sourcefn increment_minor(&self) -> Self
fn increment_minor(&self) -> Self
Increments the minor version number.
sourcefn increment_patch(&self) -> Self
fn increment_patch(&self) -> Self
Increments the patch version number.
sourcefn increment_prerelease(&self) -> Self
fn increment_prerelease(&self) -> Self
Increments the prerelease version number.
Implementations on Foreign Types§
source§impl NextVersion for Version
impl NextVersion for Version
source§fn next<I>(&self, commits: I) -> Selfwhere
I: IntoIterator,
I::Item: AsRef<str>,
fn next<I>(&self, commits: I) -> Selfwhere I: IntoIterator, I::Item: AsRef<str>,
Analyze commits and determine the next version based on conventional commits and semantic versioning:
- If no commits are passed, the version is unchanged.
- If some commits are present, but none of them match conventional commits specification, the version is incremented as a Patch.
- If some commits match conventional commits, then the next version is calculated by using these rules.
use next_version::NextVersion;
use semver::Version;
let commits = vec!["feat: make coffe"];
let version = Version::new(0, 3, 3);
assert_eq!(version.next(commits), Version::new(0, 3, 4));