Crate node_semver[][src]

Expand description

This crate is a pure Rust-based implementation of JavaScript’s node-semver. That is, it’s designed to be compatible with Node/NPM’s particular flavor of semver (which the semver crate is not).

It is designed for Rust programs and libraries meant for JavaScript tooling, and does its best to stay compatible with node-semver.

It also supports serde serialization, converting versions and ranges to strings.


node-semver includes two main types: Version and Range. See the documentation for more details.:

use node_semver::{Range, Version};

let version: Version = "1.2.3".parse().unwrap();
let range: Range = "^1.2".parse().unwrap();



Node-style semver range.

Semver version or range parsing error wrapper.

A semantic version, conformant to the semver spec.


An Identifier type for build and prerelease metadata.

The specific kind of error that occurred. Usually wrapped in a SemverError.


Maximum length of a semver string.

JavaScript’s MAX_SAFE_INTEGER. This is used to determine the maximum value for integer components in a JS-compatible way.