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