commit | 9a30136c1d4f0aea393b7696559bd8424a37af11 | [log] [tgz] |
---|---|---|
author | Chris Wailes <[email protected]> | Thu May 09 20:38:09 2024 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu May 09 20:38:09 2024 +0000 |
tree | f7a5fda58e86abf9d474f8fe19b4356d33fe1039 | |
parent | 084979502f1ffb4c4e51fa976fdb282f31a65355 [diff] | |
parent | c3c93ec8d84d8b20f3adb4430f80344c28fb9cee [diff] |
Ensure libstd is used by enabling "write" feature am: 3de05fa516 am: c3c93ec8d8 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/3081683 Change-Id: Ibf41c28d7b7c80c05998884881f0af00b1564f4f 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();