about summary refs log tree commit diff
path: root/src/libcollections
diff options
context:
space:
mode:
authordjzin <noreply@github.com>2016-12-23 21:19:21 +0000
committerdjzin <noreply@github.com>2017-01-14 16:51:50 +0000
commit3711d2f9029126bfc5410fc273ff9f9f66d6e0a5 (patch)
tree944cdb8d3d07fd517f08d07f13be6f61b4d1d543 /src/libcollections
parent35f23e8211147372f1e8917f7b41593a1aec9865 (diff)
downloadrust-3711d2f9029126bfc5410fc273ff9f9f66d6e0a5.tar.gz
rust-3711d2f9029126bfc5410fc273ff9f9f66d6e0a5.zip
impl RangeArgument for (Bound<T>, Bound<T>)
Diffstat (limited to 'src/libcollections')
-rw-r--r--src/libcollections/range.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libcollections/range.rs b/src/libcollections/range.rs
index 06ddcd13d55..92716538147 100644
--- a/src/libcollections/range.rs
+++ b/src/libcollections/range.rs
@@ -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,
+        }
+    }
+}