Skip to content

Commit

Permalink
feat(version): add .satisfies() method to Version
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Sep 24, 2021
1 parent 82625fd commit da70b18
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ pub struct Version {
}

impl Version {
/// True if this [Version] satisfies the given [Range].
pub fn satisfies(&self, range: &Range) -> bool {
range.satisfies(self)
}

/// True is this [Version] has a prerelease component.
pub fn is_prerelease(&self) -> bool {
!self.pre_release.is_empty()
Expand Down

1 comment on commit da70b18

@inderashah007
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

impl Version {
/// True if this [Version] satisfies the given [Range].
pub fn satisfies(&self, range: &Range) -> bool {
range.satisfies(self)
}

/// True is this [Version] has a prerelease component.
pub fn is_prerelease(&self) -> bool {
    !self.pre_release.is_empty()

Please sign in to comment.