pub enum VersionConstraint {
Exact(SemVer),
Compatible(SemVer),
AtLeast(SemVer),
AtMost(SemVer),
Range {
min: SemVer,
max: SemVer,
},
}Expand description
A version constraint that can be evaluated against a concrete SemVer.
Variants§
Exact(SemVer)
Exact match — only the specified version satisfies the constraint.
Compatible(SemVer)
Compatible (^) — same major, version >= specified.
AtLeast(SemVer)
At least (>=) — version >= specified (any major).
AtMost(SemVer)
At most (<=) — version <= specified.
Range
Inclusive range — min <= version <= max.
Implementations§
Source§impl VersionConstraint
impl VersionConstraint
Sourcepub fn satisfies(&self, version: &SemVer) -> bool
pub fn satisfies(&self, version: &SemVer) -> bool
Test whether version satisfies this constraint.
Sourcepub fn intersect(&self, other: &VersionConstraint) -> Option<VersionConstraint>
pub fn intersect(&self, other: &VersionConstraint) -> Option<VersionConstraint>
Attempt to compute the intersection of two constraints.
Returns None if the constraints cannot be combined into a single
Range (e.g. two Exact constraints with different versions).
Trait Implementations§
Source§impl Clone for VersionConstraint
impl Clone for VersionConstraint
Source§fn clone(&self) -> VersionConstraint
fn clone(&self) -> VersionConstraint
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 VersionConstraint
impl Debug for VersionConstraint
Source§impl PartialEq for VersionConstraint
impl PartialEq for VersionConstraint
impl Eq for VersionConstraint
impl StructuralPartialEq for VersionConstraint
Auto Trait Implementations§
impl Freeze for VersionConstraint
impl RefUnwindSafe for VersionConstraint
impl Send for VersionConstraint
impl Sync for VersionConstraint
impl Unpin for VersionConstraint
impl UnsafeUnpin for VersionConstraint
impl UnwindSafe for VersionConstraint
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<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