commit | b3ddaf1ee44260dd6cad3c6d411f85e50e918ea2 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Wed Jun 15 22:28:51 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Jun 15 22:28:51 2022 +0000 |
tree | e3c3e822585ae016995730950b05fc47a5c680f2 | |
parent | f280663077822324fcde8f87a04e4a0b0b88622a [diff] | |
parent | 51c8542cbefb591e9982562c6dde7fe6e440ac11 [diff] |
Merge "Update TEST_MAPPING" am: 90306cd26c am: c9bc811d1e am: 7245e74ced am: 51c8542cbe Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2125578 Change-Id: Icffc5c81328445c971c91102a02dd8555aeef965 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();