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