Skip to content

Commit 565e7f7

Browse files
Kaholazlpil
authored andcommitted
Provide a way to get the underlying pubgrub range from a Range.
1 parent 93657e3 commit 565e7f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/version.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,19 @@ impl From<pubgrub::Range<Version>> for Range {
262262
Self { spec, range }
263263
}
264264
}
265+
265266
impl From<Version> for Range {
266267
fn from(version: Version) -> Self {
267268
pubgrub::Range::singleton(version).into()
268269
}
269270
}
270271

272+
impl From<Range> for pubgrub::Range<Version> {
273+
fn from(range: Range) -> Self {
274+
range.range
275+
}
276+
}
277+
271278
impl fmt::Debug for Range {
272279
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
273280
f.debug_tuple("Range").field(&self.spec).finish()

0 commit comments

Comments
 (0)