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§

source

fn next<I>(&self, commits: I) -> Self
where I: IntoIterator, I::Item: AsRef<str>,

source

fn increment_major(&self) -> Self

Increments the major version number.

source

fn increment_minor(&self) -> Self

Increments the minor version number.

source

fn increment_patch(&self) -> Self

Increments the patch version number.

source

fn increment_prerelease(&self) -> Self

Increments the prerelease version number.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl NextVersion for Version

source§

fn next<I>(&self, commits: I) -> Self
where 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 = ["feat: make coffe"];
let version = Version::new(0, 3, 3);
assert_eq!(version.next(commits), Version::new(0, 3, 4));
source§

fn increment_major(&self) -> Self

source§

fn increment_minor(&self) -> Self

source§

fn increment_patch(&self) -> Self

source§

fn increment_prerelease(&self) -> Self

Implementors§