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) -> Self
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl NextVersion for Version
impl NextVersion for Version
Source§fn next<I>(&self, commits: I) -> Self
fn next<I>(&self, commits: I) -> Self
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 = ["feat: make coffe"];
let version = Version::new(0, 3, 3);
assert_eq!(version.next(commits), Version::new(0, 3, 4));