#semver #version #traits #bump #numbers #parts #semver-bump

semver-bump-trait

Provides the SemverBump trait for semver::Version

1 unstable release

0.1.0 Jan 24, 2024

#17 in #bump

MIT/Apache

16KB
231 lines

semver-bump-trait

This crate defines a SemverBump trait and implements it for the Version struct from the ubiquitous semver crate. The trait provides methods for incrementing or setting specific parts of a semantic version number.

Usage

Include SemverBump in your Cargo.toml dependencies:

[dependencies]
semver = "1.0.21"
semver-bump = "0.1.0"

Mutable API

use semver::Version;
use semver_bump_trait::SemverBump;

let mut version = Version::parse("1.1.3").unwrap();
version.mut_increment_minor();
assert_eq!(Version::parse("1.2.0").unwrap(), version);

Immutable API

use semver::Version;
use semver_bump_trait::SemverBump;

let version = Version::parse("1.1.3").unwrap();
let updated = version.increment_minor();
assert_eq!(Version::parse("1.2.0").unwrap(), updated);

API Docs

For a complete list of methods and detailed usage, refer to the API documentation.

Dependencies

~74KB