commit | c9bc811d1e4afe269048908d5f9b1a97b1114239 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Wed Jun 15 20:10:38 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Jun 15 20:10:38 2022 +0000 |
tree | e3c3e822585ae016995730950b05fc47a5c680f2 | |
parent | 871eb4c7c3580fb6469e04c4a622be50f7fcc910 [diff] | |
parent | 90306cd26ccde5018e41fdd2dfd8663acff98111 [diff] |
Merge "Update TEST_MAPPING" am: 90306cd26c Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2125578 Change-Id: I07d390327077f1f23e7d342e5e593e1359603154 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();