pub struct Version {
pub major: u64,
pub minor: u64,
pub patch: u64,
pub pre: Vec<Identifier>,
pub build: Vec<Identifier>,
}
Expand description
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§
Source§impl Ord for Version
impl Ord for Version
Source§impl PartialOrd for Version
impl PartialOrd for Version
impl Eq for Version
impl StructuralPartialEq for Version
Auto Trait Implementations§
impl Freeze for Version
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more