commit | 8b1968c06a29fe32fac43db9cb424a7b3948fb67 | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Tue Feb 06 00:33:42 2024 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Feb 06 00:33:42 2024 +0000 |
tree | 9d9548529b260bac4bd6063fc336192fadb522d7 | |
parent | a3484a314f48899674d59ff0c1704ef460033e1d [diff] | |
parent | fb9345fed011e5e1aa3b1404051507cc22be1249 [diff] |
Upgrade smallvec to 1.13.1 am: 1f97ab5903 am: fb9345fed0 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2946729 Change-Id: I3b870140475aacf3eed54b25a5e632a804eacc76 Signed-off-by: Automerger Merge Worker <[email protected]>
“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();