pub enum ConstraintSpec {
Exact(Version),
Range {
lower_inclusive: Version,
upper_exclusive: Version,
},
Tilde(Version),
Caret(Version),
GreaterEqual(Version),
Greater(Version),
LessEqual(Version),
Less(Version),
Any,
}Expand description
One typed variant per constraint kind every package manager
surfaces. Adapter is responsible for converting ~> 1.2.3 etc.
into the matching shape.
Variants§
Exact(Version)
Match exactly one version: =1.2.3.
Range
Inclusive lower bound, exclusive upper bound: >=1.2.3,<2.0.0.
Tilde(Version)
~1.2.3 — patch-level: >=1.2.3,<1.3.0. Caller-friendly
alias for the common “approximately equal to” shape.
Caret(Version)
^1.2.3 — minor-level (default Cargo behavior): >=1.2.3,<2.0.0.
Identical to Range { 1.2.3, 2.0.0 } — kept as a separate
variant for diagnostics + round-tripping.
GreaterEqual(Version)
>=1.2.3 — open upper bound. Common in npm + pip.
Greater(Version)
>1.2.3 — strict lower bound.
LessEqual(Version)
<=1.2.3 — closed upper bound.
Less(Version)
<1.2.3 — strict upper bound.
Any
* / any — matches every version. Last-resort.
Trait Implementations§
Source§impl Clone for ConstraintSpec
impl Clone for ConstraintSpec
Source§fn clone(&self) -> ConstraintSpec
fn clone(&self) -> ConstraintSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ConstraintSpec
impl Debug for ConstraintSpec
Source§impl<'de> Deserialize<'de> for ConstraintSpec
impl<'de> Deserialize<'de> for ConstraintSpec
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 PartialEq for ConstraintSpec
impl PartialEq for ConstraintSpec
Source§fn eq(&self, other: &ConstraintSpec) -> bool
fn eq(&self, other: &ConstraintSpec) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ConstraintSpec
impl Serialize for ConstraintSpec
impl Eq for ConstraintSpec
impl StructuralPartialEq for ConstraintSpec
Auto Trait Implementations§
impl Freeze for ConstraintSpec
impl RefUnwindSafe for ConstraintSpec
impl Send for ConstraintSpec
impl Sync for ConstraintSpec
impl Unpin for ConstraintSpec
impl UnsafeUnpin for ConstraintSpec
impl UnwindSafe for ConstraintSpec
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.