Skip to content

Commit

Permalink
impl RangeArgument for (Bound<T>, Bound<T>)
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow committed Jan 14, 2017
1 parent 35f23e8 commit 3711d2f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/libcollections/range.rs
Expand Up @@ -91,3 +91,21 @@ impl<T> RangeArgument<T> for Range<T> {
Excluded(&self.end)
}
}

impl<T> RangeArgument<T> for (Bound<T>, Bound<T>) {
fn start(&self) -> Bound<&T> {
match *self {
(Included(ref start), _) => Included(start),
(Excluded(ref start), _) => Excluded(start),
(Unbounded, _) => Unbounded,
}
}

fn end(&self) -> Bound<&T> {
match *self {
(_, Included(ref end)) => Included(end),
(_, Excluded(ref end)) => Excluded(end),
(_, Unbounded) => Unbounded,
}
}
}

0 comments on commit 3711d2f

Please sign in to comment.