commit | 638d0ee87b2ef1082fe674e75f89932b179fe32a | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Wed Mar 16 00:49:19 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Mar 16 00:49:19 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | 65a04b3848f2128a6672e97d66b951b683d37f53 [diff] | |
parent | d930d26b19dc62ed335563e93baa603738aa8467 [diff] |
Merge "Update TEST_MAPPING" am: 426246d395 am: 281e76a385 am: d930d26b19 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2004835 Change-Id: Ia111e882341da6a0a4b33a1bacaeb019ffc63dcd
“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();