Skip to content

Commit 727b297

Browse files
committed
Implement From<&[A::Item]> for SmallVec<A>
1 parent 2bc365e commit 727b297

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ impl<A: Array> BorrowMut<[A::Item]> for SmallVec<A> {
366366
}
367367
}
368368

369+
impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A> where A::Item: Clone {
370+
#[inline]
371+
fn from(slice: &'a [A::Item]) -> SmallVec<A> {
372+
slice.into_iter().cloned().collect()
373+
}
374+
}
375+
369376
macro_rules! impl_index {
370377
($index_type: ty, $output_type: ty) => {
371378
impl<A: Array> ops::Index<$index_type> for SmallVec<A> {

0 commit comments

Comments
 (0)