Skip to main content

NextVersion

Trait 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.

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

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§