Struct semver_parser::version::Version [−][src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Version
[src]
fn cmp(&self, other: &Version) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Version> for Version
[src]
impl PartialOrd<Version> for Version
[src]
fn partial_cmp(&self, other: &Version) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for Version
[src]
impl StructuralPartialEq for Version
[src]
Auto Trait Implementations
impl RefUnwindSafe for Version
impl Send for Version
impl Sync for Version
impl Unpin for Version
impl UnwindSafe for Version
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,