commit | 281e76a3858f0fcc4e14575f6a9675850b737d8a | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Tue Mar 15 23:45:16 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Mar 15 23:45:16 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | 3d0e7105d4fa7b048b5beeec66b8f6caf7c2816b [diff] | |
parent | 426246d39500cfa4e261f4de5981de545ee12f60 [diff] |
Merge "Update TEST_MAPPING" am: 426246d395 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2004835 Change-Id: Ic6705f047e79aa0ddfe98fcf6fd139f0486cf640
“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();