Implement From<&[A::Item]> for SmallVec<A>

This commit is contained in:
Markus
2016-07-31 21:52:51 +02:00
parent 2bc365eab3
commit 727b2974de
+7
View File
@@ -366,6 +366,13 @@ impl<A: Array> BorrowMut<[A::Item]> for SmallVec<A> {
}
}
impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A> where A::Item: Clone {
#[inline]
fn from(slice: &'a [A::Item]) -> SmallVec<A> {
slice.into_iter().cloned().collect()
}
}
macro_rules! impl_index {
($index_type: ty, $output_type: ty) => {
impl<A: Array> ops::Index<$index_type> for SmallVec<A> {