We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9ae413c + e70a266 commit e2a0467Copy full SHA for e2a0467
src/libcollections/vec.rs
@@ -2033,6 +2033,18 @@ impl<'a, T: Clone> From<&'a [T]> for Vec<T> {
2033
}
2034
2035
2036
+#[stable(feature = "vec_from_mut", since = "1.21.0")]
2037
+impl<'a, T: Clone> From<&'a mut [T]> for Vec<T> {
2038
+ #[cfg(not(test))]
2039
+ fn from(s: &'a mut [T]) -> Vec<T> {
2040
+ s.to_vec()
2041
+ }
2042
+ #[cfg(test)]
2043
2044
+ ::slice::to_vec(s)
2045
2046
+}
2047
+
2048
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
2049
impl<'a, T> From<Cow<'a, [T]>> for Vec<T> where [T]: ToOwned<Owned=Vec<T>> {
2050
fn from(s: Cow<'a, [T]>) -> Vec<T> {
0 commit comments