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