Skip to content

Commit 71a9b29

Browse files
committed
Implement From<Vec<_>> and From<[_]>.
1 parent 5c6d00e commit 71a9b29

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,20 @@ impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A> where A::Item: Clone {
828828
}
829829
}
830830

831+
impl<A: Array> From<Vec<A::Item>> for SmallVec<A> {
832+
#[inline]
833+
fn from(vec: Vec<A::Item>) -> SmallVec<A> {
834+
SmallVec::from_vec(vec)
835+
}
836+
}
837+
838+
impl<A: Array> From<A> for SmallVec<A> {
839+
#[inline]
840+
fn from(array: A) -> SmallVec<A> {
841+
SmallVec::from_buf(array)
842+
}
843+
}
844+
831845
macro_rules! impl_index {
832846
($index_type: ty, $output_type: ty) => {
833847
impl<A: Array> ops::Index<$index_type> for SmallVec<A> {

0 commit comments

Comments
 (0)