Implement From for more types on Cow
This commit is contained in:
parent
ff48277add
commit
1133a149f1
5 changed files with 71 additions and 0 deletions
|
@ -2285,6 +2285,13 @@ impl<'a, T: Clone> From<Vec<T>> for Cow<'a, [T]> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "cow_from_vec_ref", since = "1.28.0")]
|
||||
impl<'a, T: Clone> From<&'a Vec<T>> for Cow<'a, [T]> {
|
||||
fn from(v: &'a Vec<T>) -> Cow<'a, [T]> {
|
||||
Cow::Borrowed(v.as_slice())
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl<'a, T> FromIterator<T> for Cow<'a, [T]> where T: Clone {
|
||||
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> Cow<'a, [T]> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue