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