Implement Into<Vec<T>>
for SmallVector<T>
This commit is contained in:
parent
8104df27ec
commit
3b8e1f309e
@ -29,6 +29,16 @@ enum SmallVectorRepr<T> {
|
||||
Many(Vec<T>),
|
||||
}
|
||||
|
||||
impl<T> Into<Vec<T>> for SmallVector<T> {
|
||||
fn into(self) -> Vec<T> {
|
||||
match self.repr {
|
||||
Zero => Vec::new(),
|
||||
One(t) => vec![t],
|
||||
Many(vec) => vec,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> FromIterator<T> for SmallVector<T> {
|
||||
fn from_iter<I: IntoIterator<Item=T>>(iter: I) -> SmallVector<T> {
|
||||
let mut v = SmallVector::zero();
|
||||
|
Loading…
Reference in New Issue
Block a user