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) -> Option<Version>
pub fn into_latest(self) -> Option<Version>
Consumes self to produce the most recent version (determined by order of tags).
Sourcepub fn bump(&mut self, rule: Rule) -> Result<Version, PreReleaseNotFound>
pub fn bump(&mut self, rule: Rule) -> Result<Version, 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::Major] will bump the minor component. - [
Stable(Minor)] will bump the patch component.
§Errors
Can fail if trying to run Rule::Release when there is no pre-release.
pub fn stable(&self) -> Option<StableVersion>
Trait Implementations§
Source§impl Clone for PackageVersions
impl Clone for PackageVersions
Source§fn clone(&self) -> PackageVersions
fn clone(&self) -> PackageVersions
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 PackageVersions
impl Debug for PackageVersions
Source§impl Default for PackageVersions
impl Default for PackageVersions
Source§fn default() -> PackageVersions
fn default() -> PackageVersions
Returns the “default value” for a type. Read more
Source§impl From<StableVersion> for PackageVersions
impl From<StableVersion> for PackageVersions
Source§fn from(version: StableVersion) -> Self
fn from(version: StableVersion) -> Self
Converts to this type from the input type.
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
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.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>
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