pub enum VersionRange {
Any,
NoVersion,
Eq(Version),
Gt(Version),
Gte(Version),
Lt(Version),
Lte(Version),
MajorBound(Version),
And(Box<VersionRange>, Box<VersionRange>),
Or(Box<VersionRange>, Box<VersionRange>),
}Expand description
A version constraint expression.
Variants§
Any
No constraint — any version.
NoVersion
No version matches.
Eq(Version)
==V
Gt(Version)
>V
Gte(Version)
>=V
Lt(Version)
<V
Lte(Version)
<=V
MajorBound(Version)
^>=V (PVP major bound)
And(Box<VersionRange>, Box<VersionRange>)
Intersection: A && B
Or(Box<VersionRange>, Box<VersionRange>)
Union: A || B
Implementations§
Source§impl VersionRange
impl VersionRange
Sourcepub fn satisfies(&self, version: &Version) -> bool
pub fn satisfies(&self, version: &Version) -> bool
Check if a version satisfies this version range.
§Examples
use cabalist_parser::ast::{Version, VersionRange};
let v = Version { components: vec![4, 17, 0, 0] };
let range = VersionRange::MajorBound(Version { components: vec![4, 17] });
assert!(range.satisfies(&v));
let too_new = Version { components: vec![4, 18, 0, 0] };
assert!(!range.satisfies(&too_new));Trait Implementations§
Source§impl Clone for VersionRange
impl Clone for VersionRange
Source§fn clone(&self) -> VersionRange
fn clone(&self) -> VersionRange
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 VersionRange
impl Debug for VersionRange
Source§impl Display for VersionRange
impl Display for VersionRange
Source§impl PartialEq for VersionRange
impl PartialEq for VersionRange
impl Eq for VersionRange
impl StructuralPartialEq for VersionRange
Auto Trait Implementations§
impl Freeze for VersionRange
impl RefUnwindSafe for VersionRange
impl Send for VersionRange
impl Sync for VersionRange
impl Unpin for VersionRange
impl UnsafeUnpin for VersionRange
impl UnwindSafe for VersionRange
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