Skip to content

Commit

Permalink
Auto merge of #203 - UnicodingUnicorn:add-to_smallvec-to-slice, r=mbr…
Browse files Browse the repository at this point in the history
…ubeck

added to_smallvec extension trait to slice primitive

Should resolve #116.
  • Loading branch information
bors-servo committed Feb 24, 2020
2 parents 08b8249 + 511194c commit b640094
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib.rs
Expand Up @@ -1684,6 +1684,17 @@ impl_array!(
0x40000, 0x60000, 0x80000, 0x10_0000
);

trait ToSmallVec<A:Array> {
fn to_smallvec(&self) -> SmallVec<A>;
}

impl<A:Array> ToSmallVec<A> for [A::Item]
where A::Item: Copy {
fn to_smallvec(&self) -> SmallVec<A> {
SmallVec::from_slice(self)
}
}

#[cfg(test)]
mod tests {
use crate::SmallVec;
Expand Down

0 comments on commit b640094

Please sign in to comment.