commit | 6a25e1f61f6ff50d6df1d257ca09547208b18ddc | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Thu Aug 27 22:17:41 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Aug 27 22:17:41 2020 +0000 |
tree | b58c8df121ee436f44beaad028308e923ace39f5 | |
parent | 210bfb1ee43d633b311680270967680804a6c4aa [diff] | |
parent | 96174d02d72c501acba134d91caa3ad4fd977604 [diff] |
Fix smallvec/METADATA am: c38d66c8c8 am: 96174d02d7 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1414094 Change-Id: I9974c3e85b79c2c52cfb1e50d6d748090f602336
"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();