commit | 736d22dec9ef941ac5dc4e3a6cf4c11ee5a16453 | [log] [tgz] |
---|---|---|
author | Roopa Sattiraju <[email protected]> | Wed Dec 22 17:24:13 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Dec 22 17:24:13 2021 +0000 |
tree | a3a1376bc898f7520a54af076af0a6c41706cc29 | |
parent | 3f692feddaa2f4450e87bf3fe3ddb2ac0e4c15d0 [diff] | |
parent | 8464974135dd56db28e22a55b8af3a0a01a8b6f6 [diff] |
Adding bluetooth apex am: c88ecc614c am: 8464974135 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1931446 Change-Id: Icd52bf09574f81651b83d6cba76b543eca653215
“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();