commit | e60e146cde7637cb10c13d739855594b4801ccfa | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Mon Oct 12 03:41:26 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Mon Oct 12 03:41:26 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | 87c967db9934c785d4b4af2216737c174404a57b [diff] | |
parent | 9e9b36dd0eeb37acd71c8c04f3334e5bbf709e0f [diff] |
[automerger skipped] Skip ab/6749736 in stage. am: 00867e8870 -s ours am: e452407c06 -s ours am: 199741f76f -s ours am: 9e9b36dd0e -s ours am skip reason: Change-Id I6f40c13954fc23f9e9d3b81198f0cdbd19dddfc4 with SHA-1 9e821675c0 is in history Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/12797252 Change-Id: Ied3aefd2ac897e75622e1df1739cb910dd09cc93
"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();