commit | 5bb1ba303060dd9ad3adcf439e4420b1c7c82e30 | [log] [tgz] |
---|---|---|
author | Automerger Merge Worker <[email protected]> | Thu Mar 09 19:24:26 2023 +0000 |
committer | Android (Google) Code Review <[email protected]> | Thu Mar 09 19:24:26 2023 +0000 |
tree | ea4d3887b79c5a775c7539378ee2bf3a7838ca06 | |
parent | 2161ed93aa249510e9da6e1196f5e3aa3e153126 [diff] | |
parent | 4835ac1f3083875c18b1c60cb0798070a1dd3cf2 [diff] |
Merge "Make smallvec available to product and vendor am: 48d46cce35 am: 1d11037c6f am: cf55601445 am: 6a99587c55 am: 6b4608975a"
“Small vector” optimization for Rust: store up to a small number of items on the stack
use smallvec::{SmallVec, smallvec}; // This SmallVec can hold up to 4 items on the stack: let mut v: SmallVec<[i32; 4]> = smallvec![1, 2, 3, 4]; // It will automatically move its contents to the heap if // contains more than four items: v.push(5); // SmallVec points to a slice, so you can use normal slice // indexing and other methods to access its contents: v[0] = v[1] + v[2]; v.sort();