commit | 1fb67a1e461b30b5cdbd5d17c51a65edc7013ce2 | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Thu Aug 27 23:47:16 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Aug 27 23:47:16 2020 +0000 |
tree | b58c8df121ee436f44beaad028308e923ace39f5 | |
parent | fc4a30adfeced847d5fde1ff86e0f12352b1eaad [diff] | |
parent | 79c56d7cbc4c648fb14f88ca537b7391824a6cfb [diff] |
Fix smallvec/METADATA am: c38d66c8c8 am: 96174d02d7 am: 6a25e1f61f am: 79c56d7cbc Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1414094 Change-Id: I5a65eaf15a81902d2936222402d0e8584e8433d3
"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();