pub struct PackageVersion {
pub major: u32,
pub minor: u32,
pub patch: u32,
pub pre_release: Option<String>,
pub build_metadata: Option<String>,
}Expand description
Package version with semantic versioning
Fields§
§major: u32Major version number (breaking changes)
minor: u32Minor version number (backward-compatible additions)
patch: u32Patch version number (backward-compatible bug fixes)
pre_release: Option<String>Pre-release version identifier (e.g., “alpha.1”, “beta.2”)
build_metadata: Option<String>Build metadata (ignored in version precedence)
Implementations§
Source§impl PackageVersion
impl PackageVersion
Sourcepub fn is_compatible_with(&self, requirement: &VersionRequirement) -> bool
pub fn is_compatible_with(&self, requirement: &VersionRequirement) -> bool
Check if this version is compatible with a requirement
Sourcepub fn next_major(&self) -> Self
pub fn next_major(&self) -> Self
Get the next major version
Sourcepub fn next_minor(&self) -> Self
pub fn next_minor(&self) -> Self
Get the next minor version
Sourcepub fn next_patch(&self) -> Self
pub fn next_patch(&self) -> Self
Get the next patch version
Sourcepub fn is_pre_release(&self) -> bool
pub fn is_pre_release(&self) -> bool
Check if this is a pre-release version
Trait Implementations§
Source§impl Clone for PackageVersion
impl Clone for PackageVersion
Source§fn clone(&self) -> PackageVersion
fn clone(&self) -> PackageVersion
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PackageVersion
impl Debug for PackageVersion
Source§impl<'de> Deserialize<'de> for PackageVersion
impl<'de> Deserialize<'de> for PackageVersion
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 Display for PackageVersion
impl Display for PackageVersion
Source§impl From<Version> for PackageVersion
impl From<Version> for PackageVersion
Source§impl Ord for PackageVersion
impl Ord for PackageVersion
Source§impl PartialEq for PackageVersion
impl PartialEq for PackageVersion
Source§impl PartialOrd for PackageVersion
impl PartialOrd for PackageVersion
Source§impl Serialize for PackageVersion
impl Serialize for PackageVersion
impl Eq for PackageVersion
Auto Trait Implementations§
impl Freeze for PackageVersion
impl RefUnwindSafe for PackageVersion
impl Send for PackageVersion
impl Sync for PackageVersion
impl Unpin for PackageVersion
impl UnsafeUnpin for PackageVersion
impl UnwindSafe for PackageVersion
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