impl RangeArgument for (Bound<T>, Bound<T>)

This commit is contained in:
djzin 2016-12-23 21:19:21 +00:00
parent 35f23e8211
commit 3711d2f902

View File

@ -91,3 +91,21 @@ fn end(&self) -> Bound<&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,
}
}
}