mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 04:14:28 +00:00
Implement From<&mut [T]> for Vec
This commit is contained in:
parent
0777c757a6
commit
e70a266b3b
@ -1984,6 +1984,18 @@ impl<'a, T: Clone> From<&'a [T]> for Vec<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "vec_from_mut", since = "1.21.0")]
|
||||
impl<'a, T: Clone> From<&'a mut [T]> for Vec<T> {
|
||||
#[cfg(not(test))]
|
||||
fn from(s: &'a mut [T]) -> Vec<T> {
|
||||
s.to_vec()
|
||||
}
|
||||
#[cfg(test)]
|
||||
fn from(s: &'a mut [T]) -> Vec<T> {
|
||||
::slice::to_vec(s)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "vec_from_cow_slice", since = "1.14.0")]
|
||||
impl<'a, T> From<Cow<'a, [T]>> for Vec<T> where [T]: ToOwned<Owned=Vec<T>> {
|
||||
fn from(s: Cow<'a, [T]>) -> Vec<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user