about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/owned_slice.rs8
-rw-r--r--src/libsyntax/util/small_vector.rs20
2 files changed, 14 insertions, 14 deletions
diff --git a/src/libsyntax/owned_slice.rs b/src/libsyntax/owned_slice.rs
index 4f09b34557c..f622e2d6112 100644
--- a/src/libsyntax/owned_slice.rs
+++ b/src/libsyntax/owned_slice.rs
@@ -112,6 +112,10 @@ impl<T> OwnedSlice<T> {
     pub fn map<U>(&self, f: |&T| -> U) -> OwnedSlice<U> {
         self.iter().map(f).collect()
     }
+
+    pub fn len(&self) -> uint { self.len }
+
+    pub fn is_empty(&self) -> bool { self.len == 0 }
 }
 
 impl<T> Default for OwnedSlice<T> {
@@ -140,10 +144,6 @@ impl<T: PartialEq> PartialEq for OwnedSlice<T> {
 
 impl<T: Eq> Eq for OwnedSlice<T> {}
 
-impl<T> Collection for OwnedSlice<T> {
-    fn len(&self) -> uint { self.len }
-}
-
 impl<T> FromIterator<T> for OwnedSlice<T> {
     fn from_iter<I: Iterator<T>>(mut iter: I) -> OwnedSlice<T> {
         OwnedSlice::from_vec(iter.collect())
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs
index 422c2d5c75b..56ee6c7b915 100644
--- a/src/libsyntax/util/small_vector.rs
+++ b/src/libsyntax/util/small_vector.rs
@@ -25,16 +25,6 @@ enum SmallVectorRepr<T> {
     Many(Vec<T>),
 }
 
-impl<T> Collection for SmallVector<T> {
-    fn len(&self) -> uint {
-        match self.repr {
-            Zero => 0,
-            One(..) => 1,
-            Many(ref vals) => vals.len()
-        }
-    }
-}
-
 impl<T> FromIterator<T> for SmallVector<T> {
     fn from_iter<I: Iterator<T>>(iter: I) -> SmallVector<T> {
         let mut v = SmallVector::zero();
@@ -131,6 +121,16 @@ impl<T> SmallVector<T> {
         };
         MoveItems { repr: repr }
     }
+
+    pub fn len(&self) -> uint {
+        match self.repr {
+            Zero => 0,
+            One(..) => 1,
+            Many(ref vals) => vals.len()
+        }
+    }
+
+    pub fn is_empty(&self) -> bool { self.len() == 0 }
 }
 
 pub struct MoveItems<T> {