]> git.lizzy.rs Git - rust.git/commitdiff
Implement AsMut for Vec
authorUlrik Sverdrup <bluss@users.noreply.github.com>
Fri, 25 Sep 2015 15:43:58 +0000 (17:43 +0200)
committerUlrik Sverdrup <bluss@users.noreply.github.com>
Fri, 25 Sep 2015 15:43:58 +0000 (17:43 +0200)
Fixes #28549

src/libcollections/vec.rs

index c99460a55c9522a82a350c462f7837fb7b798ec4..6375fa489ee2fc7fcc02751da55a960ec93ac502 100644 (file)
@@ -1359,6 +1359,13 @@ fn as_ref(&self) -> &[T] {
     }
 }
 
+#[stable(feature = "vec_as_mut", since = "1.5.0")]
+impl<T> AsMut<[T]> for Vec<T> {
+    fn as_mut(&mut self) -> &mut [T] {
+        self
+    }
+}
+
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, T: Clone> From<&'a [T]> for Vec<T> {
     #[cfg(not(test))]