mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-10 03:28:18 +02:00
compiler/rust/smallvec: Implement From<SmallVec<T>> for Vec<T>
Reviewed-by: Mel Henning <mhenning@darkrefraction.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41941>
This commit is contained in:
parent
5c98f152a3
commit
d8e586dd3b
1 changed files with 10 additions and 0 deletions
|
|
@ -161,6 +161,16 @@ impl<T> FromIterator<T> for SmallVec<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> From<SmallVec<T>> for Vec<T> {
|
||||
fn from(sv: SmallVec<T>) -> Vec<T> {
|
||||
match sv {
|
||||
SmallVec::None => Vec::new(),
|
||||
SmallVec::One(i) => vec![i],
|
||||
SmallVec::Many(v) => v,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum IntoIterImpl<T> {
|
||||
None,
|
||||
One(T),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue