pub struct SemVer {
pub major: u64,
pub minor: u64,
pub patch: u64,
pub has_v_prefix: bool,
}Expand description
Represents a parsed Semantic Version (SemVer 2.0.0).
Fields§
§major: u64Major version number.
minor: u64Minor version number.
patch: u64Patch version number.
has_v_prefix: boolWhether the original version string was prefixed with ‘v’.
Implementations§
Source§impl SemVer
impl SemVer
Sourcepub fn bump(&self, bump: BumpType) -> SemVer
pub fn bump(&self, bump: BumpType) -> SemVer
Bumps this semantic version according to the specified BumpType.
Preserves the has_v_prefix flag.
§Arguments
bump- The type of bump to perform (Patch, Minor, Major).
§Example
use git_claw::core::semver::{BumpType, SemVer};
let v = SemVer { major: 1, minor: 2, patch: 3, has_v_prefix: true };
assert_eq!(v.bump(BumpType::Patch).to_string(), "v1.2.4");
assert_eq!(v.bump(BumpType::Minor).to_string(), "v1.3.0");
assert_eq!(v.bump(BumpType::Major).to_string(), "v2.0.0");Trait Implementations§
impl Eq for SemVer
impl StructuralPartialEq for SemVer
Auto Trait Implementations§
impl Freeze for SemVer
impl RefUnwindSafe for SemVer
impl Send for SemVer
impl Sync for SemVer
impl Unpin for SemVer
impl UnsafeUnpin for SemVer
impl UnwindSafe for SemVer
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.