[][src]Struct semver_parser::version::Version

pub struct Version {
    pub major: u64,
    pub minor: u64,
    pub patch: u64,
    pub pre: Vec<Identifier>,
    pub build: Vec<Identifier>,
}

Structure representing version data.

Version struct has some public fields representing version data, like major/minor version string, patch number and vectors of prefix and build identifiers.

Examples

Parsing Version from string and checking its fields:

use semver_parser::version;

let version = version::parse("0.1.2-alpha1")?;
assert_eq!(version.major, 0);
assert_eq!(version.minor, 1);
assert_eq!(version.patch, 2);
let expected_pre = vec![version::Identifier::AlphaNumeric(String::from("alpha1"))];
assert_eq!(expected_pre, version.pre);

Fields

major: u64

Major version as number (0 in "0.1.2").

minor: u64

Minor version as number (1 in "0.1.2").

patch: u64

Patch version as number (2 in "0.1.2").

pre: Vec<Identifier>

Pre-release metadata as a vector of Identifier ("alpha1" in "0.1.2-alpha1" or 7 (numeric) in "0.1.2-7", "pre" and 0 (numeric) in "0.1.2-pre.0").

build: Vec<Identifier>

Build metadata as a vector of Identifier ("build1" in "0.1.2+build1" or 7 (numeric) in "0.1.2+7", "build" and 0 (numeric) in "0.1.2+pre.0").

Trait Implementations

impl Clone for Version[src]

impl Debug for Version[src]

impl Display for Version[src]

impl Eq for Version[src]

impl Hash for Version[src]

impl Ord for Version[src]

impl PartialEq<Version> for Version[src]

impl PartialOrd<Version> for Version[src]

impl StructuralEq for Version[src]

impl StructuralPartialEq for Version[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.