Struct plow_package_management::version::SemanticVersion
source · pub struct SemanticVersion { /* private fields */ }
Expand description
Our own semantic version type to use in pubgrub based resolver.
Implementations§
source§impl SemanticVersion
impl SemanticVersion
sourcepub const fn new(major: u64, minor: u64, patch: u64) -> Self
pub const fn new(major: u64, minor: u64, patch: u64) -> Self
Create a version with “major”, “minor” and “patch” values.
version = major.minor.patch
pub const fn as_sum(&self) -> u64
sourcepub const fn bump_patch(self) -> Self
pub const fn bump_patch(self) -> Self
Bump the patch number of a version.
sourcepub const fn bump_minor(self) -> Self
pub const fn bump_minor(self) -> Self
Bump the minor number of a version.
sourcepub const fn bump_major(self) -> Self
pub const fn bump_major(self) -> Self
Bump the major number of a version.
sourcepub const fn is_patch_zero(&self) -> bool
pub const fn is_patch_zero(&self) -> bool
Returns true
if the patch field of the version is 0.
sourcepub const fn is_minor_zero(&self) -> bool
pub const fn is_minor_zero(&self) -> bool
Returns true
if the minor field of the version is 0.
sourcepub const fn is_major_zero(&self) -> bool
pub const fn is_major_zero(&self) -> bool
Returns true
if the major field of the version is 0.
Trait Implementations§
source§impl Clone for SemanticVersion
impl Clone for SemanticVersion
source§fn clone(&self) -> SemanticVersion
fn clone(&self) -> SemanticVersion
Returns a copy 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 SemanticVersion
impl Debug for SemanticVersion
source§impl Default for SemanticVersion
impl Default for SemanticVersion
source§fn default() -> SemanticVersion
fn default() -> SemanticVersion
Returns the “default value” for a type. Read more
source§impl<'req_resolver> DependencyProvider<String, SemanticVersion> for VersionRequestResolver<'req_resolver>
impl<'req_resolver> DependencyProvider<String, SemanticVersion> for VersionRequestResolver<'req_resolver>
source§fn choose_package_version<T: Borrow<String>, U: Borrow<Range<SemanticVersion>>>(
&self,
potential_packages: impl Iterator<Item = (T, U)>
) -> Result<(T, Option<SemanticVersion>), Box<dyn Error>>
fn choose_package_version<T: Borrow<String>, U: Borrow<Range<SemanticVersion>>>( &self, potential_packages: impl Iterator<Item = (T, U)> ) -> Result<(T, Option<SemanticVersion>), Box<dyn Error>>
Decision making
is the process of choosing the next package
and version that will be appended to the partial solution.
Every time such a decision must be made,
potential valid packages and version ranges are preselected by the resolver,
and the dependency provider must choose. Read more
source§fn get_dependencies(
&self,
package: &String,
version: &SemanticVersion
) -> Result<Dependencies<String, SemanticVersion>, Box<dyn Error>>
fn get_dependencies( &self, package: &String, version: &SemanticVersion ) -> Result<Dependencies<String, SemanticVersion>, Box<dyn Error>>
Retrieves the package dependencies.
Return Dependencies::Unknown if its dependencies are unknown.
source§fn should_cancel(&self) -> Result<(), Box<dyn Error>>
fn should_cancel(&self) -> Result<(), Box<dyn Error>>
This is called fairly regularly during the resolution,
if it returns an Err then resolution will be terminated.
This is helpful if you want to add some form of early termination like a timeout,
or you want to add some form of user feedback if things are taking a while.
If not provided the resolver will run as long as needed.
source§impl<'de> Deserialize<'de> for SemanticVersion
impl<'de> Deserialize<'de> for SemanticVersion
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 SemanticVersion
impl Display for SemanticVersion
source§impl From<SemanticVersion> for (u64, u64, u64)
impl From<SemanticVersion> for (u64, u64, u64)
source§fn from(v: SemanticVersion) -> Self
fn from(v: SemanticVersion) -> Self
Converts to this type from the input type.
source§impl FromStr for SemanticVersion
impl FromStr for SemanticVersion
source§impl Hash for SemanticVersion
impl Hash for SemanticVersion
source§impl Ord for SemanticVersion
impl Ord for SemanticVersion
source§fn cmp(&self, other: &SemanticVersion) -> Ordering
fn cmp(&self, other: &SemanticVersion) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<SemanticVersion> for SemanticVersion
impl PartialEq<SemanticVersion> for SemanticVersion
source§fn eq(&self, other: &SemanticVersion) -> bool
fn eq(&self, other: &SemanticVersion) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SemanticVersion> for SemanticVersion
impl PartialOrd<SemanticVersion> for SemanticVersion
source§fn partial_cmp(&self, other: &SemanticVersion) -> Option<Ordering>
fn partial_cmp(&self, other: &SemanticVersion) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl RangeExt<SemanticVersion> for Range<SemanticVersion>
impl RangeExt<SemanticVersion> for Range<SemanticVersion>
source§impl Serialize for SemanticVersion
impl Serialize for SemanticVersion
source§impl TryFrom<&String> for SemanticVersion
impl TryFrom<&String> for SemanticVersion
source§impl TryFrom<&str> for SemanticVersion
impl TryFrom<&str> for SemanticVersion
source§impl TryFrom<String> for SemanticVersion
impl TryFrom<String> for SemanticVersion
source§impl Version for SemanticVersion
impl Version for SemanticVersion
impl Copy for SemanticVersion
impl Eq for SemanticVersion
impl StructuralEq for SemanticVersion
impl StructuralPartialEq for SemanticVersion
Auto Trait Implementations§
impl RefUnwindSafe for SemanticVersion
impl Send for SemanticVersion
impl Sync for SemanticVersion
impl Unpin for SemanticVersion
impl UnwindSafe for SemanticVersion
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