commit | c004a69014a9474ebfcfa357d7a3afefbf7d78bd | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Mon Feb 06 17:14:13 2023 +0000 |
committer | Automerger Merge Worker <[email protected]> | Mon Feb 06 17:14:13 2023 +0000 |
tree | e7ccbbbfb133da56e0cac7a08cc21948ffe3ab7d | |
parent | 59be2372fd41d768906a1cdb29b56bd4147b2a1a [diff] | |
parent | 76fd734e7f2b76c359e2e849afe60291fbaf26d8 [diff] |
Upgrade smallvec to 1.10.0 am: db74ff043c am: 60b9cf9692 am: 76fd734e7f Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2422379 Change-Id: I61d8a2b1991c1c1021cafb5b938003dae60d33b3 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();