about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorJorge Aparicio <japaric@linux.com>2014-08-31 02:09:46 -0500
committerJorge Aparicio <japaric@linux.com>2014-08-31 02:28:37 -0500
commit417e4b41bbf347a183766c97055ac6625cff1e70 (patch)
tree82d66e7f0774ccff42837aaca0e2470fbf2805a3 /src/libcore
parentc2564540de933c2dfe48cc72f947b29853ab2803 (diff)
&mut [T] now implements Collection. Fixes #16896
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/slice.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs
index 5070a3973d1..dc048bf5ed4 100644
--- a/src/libcore/slice.rs
+++ b/src/libcore/slice.rs
@@ -991,6 +991,15 @@ impl<'a, T> Collection for &'a [T] {
     }
 }
 
+#[experimental = "trait is experimental"]
+impl<'a, T> Collection for &'a mut [T] {
+    /// Returns the length of a vector
+    #[inline]
+    fn len(&self) -> uint {
+        self.repr().len
+    }
+}
+
 #[unstable = "waiting for DST"]
 impl<'a, T> Default for &'a [T] {
     fn default() -> &'a [T] { &[] }