Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b640094

Browse files
author
bors-servo
authoredFeb 24, 2020
Auto merge of #203 - UnicodingUnicorn:add-to_smallvec-to-slice, r=mbrubeck
added to_smallvec extension trait to slice primitive Should resolve #116.
2 parents 08b8249 + 511194c commit b640094

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,6 +1684,17 @@ impl_array!(
16841684
0x40000, 0x60000, 0x80000, 0x10_0000
16851685
);
16861686

1687+
trait ToSmallVec<A:Array> {
1688+
fn to_smallvec(&self) -> SmallVec<A>;
1689+
}
1690+
1691+
impl<A:Array> ToSmallVec<A> for [A::Item]
1692+
where A::Item: Copy {
1693+
fn to_smallvec(&self) -> SmallVec<A> {
1694+
SmallVec::from_slice(self)
1695+
}
1696+
}
1697+
16871698
#[cfg(test)]
16881699
mod tests {
16891700
use crate::SmallVec;

0 commit comments

Comments
 (0)
Please sign in to comment.