commit | d74b6845916772d35cfa509728c48e53773e1fcb | [log] [tgz] |
---|---|---|
author | Joel Galenson <[email protected]> | Wed Dec 15 18:07:25 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Dec 15 18:07:25 2021 +0000 |
tree | 7569440475603d4e38e2f550b90803081226481b | |
parent | d27b37abcb00b6ed5ea67fe5b9a37dd0af22d5fc [diff] | |
parent | 51c7b5e9edc8ee87debf63de2d6e06e987a04b6b [diff] |
Merge "Refresh Android.bp, cargo2android.json, TEST_MAPPING." am: 44b1240f83 am: 4541755b55 am: 3f692fedda am: 51c7b5e9ed Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1912852 Change-Id: I7055c8d92b16469ea78b96c1997d6fb066fb4c0d
“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();