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