commit | 3f692feddaa2f4450e87bf3fe3ddb2ac0e4c15d0 | [log] [tgz] |
---|---|---|
author | Joel Galenson <jgalenson@google.com> | Wed Dec 15 16:43:51 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Dec 15 16:43:51 2021 +0000 |
tree | 7569440475603d4e38e2f550b90803081226481b | |
parent | dd7deac4d676d29daf106d7732e04f8a56592180 [diff] | |
parent | 4541755b559c0926e02c8eca7045d92d3ef4c1bb [diff] |
Merge "Refresh Android.bp, cargo2android.json, TEST_MAPPING." am: 44b1240f83 am: 4541755b55 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1912852 Change-Id: Ib61c06a3eed981beeeb1ecc5e24c51c9b7f365c9
“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();