commit | 9e9b36dd0eeb37acd71c8c04f3334e5bbf709e0f | [log] [tgz] |
---|---|---|
author | Xin Li <[email protected]> | Mon Oct 12 03:17:29 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Mon Oct 12 03:17:29 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | 68fddd55b7f487b56ddeef294a5d2f2c6b00f640 [diff] | |
parent | 199741f76fdea652c7fe6323385705eb28c6f3eb [diff] |
[automerger skipped] Skip ab/6749736 in stage. am: 00867e8870 -s ours am: e452407c06 -s ours am: 199741f76f -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: Ide14077c617a01131f415493b13721b5ce3bc205
“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();