pub struct Version {
pub major: u64,
pub minor: u64,
pub patch: u64,
pub pre: Vec<Identifier>,
pub build: Vec<Identifier>,
}
Expand description
Represents a version number conforming to the semantic versioning scheme.
Fields§
§major: u64
The major version, to be incremented on incompatible changes.
minor: u64
The minor version, to be incremented when functionality is added in a backwards-compatible manner.
patch: u64
The patch version, to be incremented when backwards-compatible bug fixes are made.
pre: Vec<Identifier>
The pre-release version identifier, if one exists.
build: Vec<Identifier>
The build metadata, ignored when determining version precedence.
Implementations§
Source§impl Version
impl Version
Sourcepub fn new(major: u64, minor: u64, patch: u64) -> Version
pub fn new(major: u64, minor: u64, patch: u64) -> Version
Contructs the simple case without pre or build.
Sourcepub fn parse(version: &str) -> Result<Version, SemVerError>
pub fn parse(version: &str) -> Result<Version, SemVerError>
Parse a string into a semver object.
Sourcepub fn increment_patch(&mut self)
pub fn increment_patch(&mut self)
Increments the patch number for this Version (Must be mutable)
Sourcepub fn increment_minor(&mut self)
pub fn increment_minor(&mut self)
Increments the minor version number for this Version (Must be mutable)
As instructed by section 7 of the spec, the patch number is reset to 0.
Sourcepub fn increment_major(&mut self)
pub fn increment_major(&mut self)
Increments the major version number for this Version (Must be mutable)
As instructed by section 8 of the spec, the minor and patch numbers are reset to 0
Sourcepub fn is_prerelease(&self) -> bool
pub fn is_prerelease(&self) -> bool
Checks to see if the current Version is in pre-release status
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Version, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Version, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Ord for Version
impl Ord for Version
Source§impl PartialOrd for Version
impl PartialOrd for Version
Source§impl Serialize for Version
impl Serialize for Version
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more