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