pub struct Version { /* private fields */ }
Expand description
Semantic version representation following SemVer
2.0.0
Implementations§
Source§impl Version
impl Version
Sourcepub fn parse_simple(versionstr: &str) -> Result<Self, String>
pub fn parse_simple(versionstr: &str) -> Result<Self, String>
Parse a simple version string (major.minor.patch format only)
Sourcepub fn release(major: u64, minor: u64, patch: u64, prerelease: String) -> Self
pub fn release(major: u64, minor: u64, patch: u64, prerelease: String) -> Self
Create a version with pre-release
Sourcepub fn parse(versionstr: &str) -> Result<Self, CoreError>
pub fn parse(versionstr: &str) -> Result<Self, CoreError>
Parse a version string (supports pre-release and build metadata)
Sourcepub fn prerelease(&self) -> Option<&str>
pub fn prerelease(&self) -> Option<&str>
Get pre-release identifier
Sourcepub fn buildmetadata(&self) -> Option<&str>
pub fn buildmetadata(&self) -> Option<&str>
Get build metadata
Sourcepub fn is_prerelease(&self) -> bool
pub fn is_prerelease(&self) -> bool
Check if this is a pre-release version
Sourcepub fn increment_major(&mut self)
pub fn increment_major(&mut self)
Increment major version (resets minor and patch to 0)
Sourcepub fn increment_minor(&mut self)
pub fn increment_minor(&mut self)
Increment minor version (resets patch to 0)
Sourcepub fn increment_patch(&mut self)
pub fn increment_patch(&mut self)
Increment patch version
Sourcepub fn is_compatible_with(&self, other: &Self) -> bool
pub fn is_compatible_with(&self, other: &Self) -> bool
Check if this version is compatible with another version
Sourcepub fn has_breakingchanges_from(&self, other: &Self) -> bool
pub fn has_breakingchanges_from(&self, other: &Self) -> bool
Check if this version has breaking changes compared to another
Sourcepub fn core_version(&self) -> Self
pub fn core_version(&self) -> Self
Get the core version without pre-release or build metadata
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Version
impl<'de> Deserialize<'de> for Version
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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
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>
Converts
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>
Converts
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