commit | 38a95dd734eb4e673047a2fd4b9943a2cdd921d6 | [log] [tgz] |
---|---|---|
author | Roopa Sattiraju <sattiraju@google.com> | Wed Dec 22 17:47:57 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Wed Dec 22 17:47:57 2021 +0000 |
tree | a3a1376bc898f7520a54af076af0a6c41706cc29 | |
parent | 51c7b5e9edc8ee87debf63de2d6e06e987a04b6b [diff] | |
parent | 736d22dec9ef941ac5dc4e3a6cf4c11ee5a16453 [diff] |
Adding bluetooth apex am: c88ecc614c am: 8464974135 am: 736d22dec9 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1931446 Change-Id: I08abdac8058df570a60e8676f7ef2ee787bf71a3
"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();