pub enum VersionSpec {
}Expand description
Version specification (constraint)
Variants§
Pinned(Version)
==1.2.3
Minimum(Version)
=1.2.3
Maximum(Version)
<=1.2.3
GreaterThan(Version)
1.2.3
LessThan(Version)
<1.2.3
Range
=1.2.3,<2.0.0
Caret(Version)
^1.2.3 (caret - same major)
Tilde(Version)
~1.2.3 (tilde - same minor)
Compatible(Version)
~=1.2.3 (compatible release)
Wildcard
==1.2.*
NotEqual(Version)
!=1.2.3
Complex(String)
Complex constraint we store as raw string
Any
Any version (no constraint or *)
Implementations§
Source§impl VersionSpec
impl VersionSpec
Sourcepub fn parse(s: &str) -> Result<Self, VersionError>
pub fn parse(s: &str) -> Result<Self, VersionError>
Parse a version specifier string
Sourcepub fn satisfies(&self, version: &Version) -> bool
pub fn satisfies(&self, version: &Version) -> bool
Check if a version satisfies this constraint
Sourcepub fn base_version(&self) -> Option<&Version>
pub fn base_version(&self) -> Option<&Version>
Get the base version from the spec (for comparison)
Sourcepub fn max_major(&self) -> Option<u64>
pub fn max_major(&self) -> Option<u64>
Get the maximum allowed major version (for “in range” calculation)
Sourcepub fn with_version(&self, new_version: &Version) -> VersionSpec
pub fn with_version(&self, new_version: &Version) -> VersionSpec
Create a new version spec with updated version but same constraint type
Trait Implementations§
Source§impl Clone for VersionSpec
impl Clone for VersionSpec
Source§fn clone(&self) -> VersionSpec
fn clone(&self) -> VersionSpec
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 VersionSpec
impl Debug for VersionSpec
Source§impl Display for VersionSpec
impl Display for VersionSpec
Source§impl PartialEq for VersionSpec
impl PartialEq for VersionSpec
impl Eq for VersionSpec
impl StructuralPartialEq for VersionSpec
Auto Trait Implementations§
impl Freeze for VersionSpec
impl RefUnwindSafe for VersionSpec
impl Send for VersionSpec
impl Sync for VersionSpec
impl Unpin for VersionSpec
impl UnwindSafe for VersionSpec
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.