commit | e320b8566b1de46fd11f2ccf0d2823128b119dcb | [log] [tgz] |
---|---|---|
author | James Farrell <[email protected]> | Fri Aug 30 03:48:58 2024 +0000 |
committer | Automerger Merge Worker <[email protected]> | Fri Aug 30 03:48:58 2024 +0000 |
tree | 4ccc9609d29c6f2484dc04b212e0e378d43ca51c | |
parent | e465bf041e20361f260c1893e674ad6b2dedc691 [diff] | |
parent | 2b2231c2c1a14660dcf8c08072cc1347287a2262 [diff] |
Migrate 25 crates to monorepo. am: eacd222621 am: 2b2231c2c1 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/3249090 Change-Id: I5b63909e2a4892cec1ccec3994163af498ccd23f 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();