commit | bcf3e391964e48052ccea2af78ba1e2b73a32c6b | [log] [tgz] |
---|---|---|
author | Joel Galenson <[email protected]> | Thu Jul 30 16:13:58 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Jul 30 16:13:58 2020 +0000 |
tree | 8223f93f4c104458c4f90e4da7b560a5feeef97a | |
parent | bad093c151c755bec4aaaa10b7deb34e8f88c05b [diff] | |
parent | a755d3718eaadace9fd29b65613d6a45165db835 [diff] |
Add Android.bp am: f19ca66ae6 am: 582f7048fb am: a755d3718e Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1374115 Change-Id: Id843a1993e370ecd40d18d42bd2513beebfd3953
“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();