pub struct Range(/* private fields */);
Expand description
Node-style semver range.
These ranges map mostly 1:1 to semver’s except for some internal representation details that allow some more interesting set-level operations.
For details on supported syntax, see https://github.com/npm/node-semver#advanced-range-syntax
Implementations§
Source§impl Range
impl Range
Sourcepub fn parse<S: AsRef<str>>(input: S) -> Result<Self, SemverError>
pub fn parse<S: AsRef<str>>(input: S) -> Result<Self, SemverError>
Parse a range from a string.
Sourcepub fn satisfies(&self, version: &Version) -> bool
pub fn satisfies(&self, version: &Version) -> bool
Returns true if version
is satisfied by this range.
Sourcepub fn allows_all(&self, other: &Range) -> bool
pub fn allows_all(&self, other: &Range) -> bool
Returns true if other
is a strict superset of this range.
Sourcepub fn allows_any(&self, other: &Range) -> bool
pub fn allows_any(&self, other: &Range) -> bool
Returns true if other
has overlap with this range.
Sourcepub fn intersect(&self, other: &Self) -> Option<Self>
pub fn intersect(&self, other: &Self) -> Option<Self>
Returns a new range that is the set-intersection between this range and other
.
Sourcepub fn difference(&self, other: &Self) -> Option<Self>
pub fn difference(&self, other: &Self) -> Option<Self>
Returns a new range that is the set-difference between this range and other
.
Sourcepub fn min_version(&self) -> Option<Version>
pub fn min_version(&self) -> Option<Version>
Returns the minimum version that satisfies this range.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Range
impl<'de> Deserialize<'de> for Range
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
impl Eq for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Freeze for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnwindSafe for Range
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