Module version

Source
Expand description

Version data and functions.

This module contains Version struct, parse function for building Version struct from string and some helper data structures and functions.

§Examples

Parsing Version from string and checking its fields:

use semver_parser::version;

let version = version::parse("1.2.3-alpha1")?;

assert_eq!(version.major, 1);
assert_eq!(version.minor, 2);
assert_eq!(version.patch, 3);

let expected_pre = vec![
    version::Identifier::AlphaNumeric(String::from("alpha1")),
];

assert_eq!(expected_pre, version.pre);

Structs§

Version
Structure representing version data.

Enums§

Identifier
Helper enum for holding data of alphanumeric or numeric suffix identifiers.

Functions§

parse
Function for parsing version string to Version.