Struct knope_versioning::semver::PackageVersions
source · pub struct PackageVersions { /* private fields */ }Expand description
It’s not enough to just track one version for each package, we need:
- The latest stable version (if any)
- The last version of each type of pre-release following the latest stable version
So we might have 1.2.3, 1.2.4-rc.1, 1.3.0-beta.0, and 2.0.0-alpha.4
Implementations§
source§impl PackageVersions
impl PackageVersions
Get the (relevant) current versions from a slice of Git tags.
Tags are expected to either be v{version} or {prefix}/v{version} (if supplied),
§Parameters
prefix: Only tag names starting with this string will be considered.all_tags: All tags in the repository.
sourcepub fn into_latest(self) -> Version
pub fn into_latest(self) -> Version
Consumes self to produce the most recent version (determined by order of tags).
sourcepub fn update_version(&mut self, version: Version)
pub fn update_version(&mut self, version: Version)
Replace or insert the version in the correct location if it’s newer than the current
equivalent version.
If the version is a newer stable version, it will update stable
and erase all pre-releases.
If the version is a newer prerelease, it will overwrite the prerelease with
the same stable component and label.
sourcepub fn bump(&mut self, rule: Rule) -> Result<(), PreReleaseNotFound>
pub fn bump(&mut self, rule: Rule) -> Result<(), PreReleaseNotFound>
Apply a Rule to a [PackageVersion], incrementing & resetting the correct components.
§Versions 0.x
Versions with major component 0 have special meaning in Semantic Versioning and therefore have different behavior:
Rule::Majorwill bump the minor component.Rule::Minorwill bump the patch component.
§Errors
Can fail if trying to run Rule::Release when there is no pre-release.
pub fn stable(&self) -> StableVersion
Trait Implementations§
source§impl Clone for PackageVersions
impl Clone for PackageVersions
source§fn clone(&self) -> PackageVersions
fn clone(&self) -> PackageVersions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for PackageVersions
impl Debug for PackageVersions
source§impl Default for PackageVersions
impl Default for PackageVersions
source§fn default() -> PackageVersions
fn default() -> PackageVersions
source§impl From<StableVersion> for PackageVersions
impl From<StableVersion> for PackageVersions
source§fn from(version: StableVersion) -> Self
fn from(version: StableVersion) -> Self
source§impl From<Version> for PackageVersions
impl From<Version> for PackageVersions
source§impl PartialEq for PackageVersions
impl PartialEq for PackageVersions
impl Eq for PackageVersions
impl StructuralPartialEq for PackageVersions
Auto Trait Implementations§
impl Freeze for PackageVersions
impl RefUnwindSafe for PackageVersions
impl Send for PackageVersions
impl Sync for PackageVersions
impl Unpin for PackageVersions
impl UnwindSafe for PackageVersions
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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
key and return true if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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