commit | 4541755b559c0926e02c8eca7045d92d3ef4c1bb | [log] [tgz] |
---|---|---|
author | Joel Galenson <[email protected]> | Wed Dec 15 16:02:44 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Dec 15 16:02:44 2021 +0000 |
tree | 7569440475603d4e38e2f550b90803081226481b | |
parent | dd7deac4d676d29daf106d7732e04f8a56592180 [diff] | |
parent | 44b1240f837efb35816b93aa586ff47ba72dacb9 [diff] |
Merge "Refresh Android.bp, cargo2android.json, TEST_MAPPING." am: 44b1240f83 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1912852 Change-Id: Iaf64c7f2a0555f427d184c7ba4f485b9aa517474
“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();