pub struct Range { /* private fields */ }Expand description
A parsed range: one or more comparator sets joined by ||, optionally
scoped to a context (npm:react@^18).
Implementations§
Source§impl Range
impl Range
Sourcepub fn parse(input: &str) -> Result<Self, Error>
pub fn parse(input: &str) -> Result<Self, Error>
Parse a range. Advanced syntax (hyphen, x-ranges, ~, ~>, ^, -*,
*-*) desugars to primitive comparators exactly as in the specification.
Sourcepub fn comparator_sets(&self) -> impl Iterator<Item = &[Comparator]>
pub fn comparator_sets(&self) -> impl Iterator<Item = &[Comparator]>
The desugared comparator sets.
Sourcepub fn test(&self, version: &Version) -> bool
pub fn test(&self, version: &Version) -> bool
True if version satisfies the range. A context-scoped range only
admits versions of the same context.
Sourcepub fn satisfies(&self, version: &Version) -> bool
pub fn satisfies(&self, version: &Version) -> bool
Alias of Range::test.
Trait Implementations§
impl Eq for Range
impl StructuralPartialEq for Range
Auto Trait Implementations§
impl Forget for Range
impl Freeze for Range
impl Move for Range
impl RefUnwindSafe for Range
impl Send for Range
impl Sync for Range
impl Unpin for Range
impl UnsafeUnpin 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