| commit | 98f668ad547160e27bd1b283de533878ec1d622b | [log] [tgz] |
|---|---|---|
| author | Android Build Coastguard Worker <[email protected]> | Wed Apr 19 02:56:12 2023 +0000 |
| committer | Automerger Merge Worker <[email protected]> | Wed Apr 19 02:56:12 2023 +0000 |
| tree | 40c1ec7f8824c6f65686d9ffb768102f82961542 | |
| parent | b8725882e08a9e19e00be2e4430cb2b1c598e805 [diff] | |
| parent | c30791a55e277f30ae20d6a6db19a72e096cab3c [diff] |
Snap for 9966400 from 28ee3e669df78bf94e18d0a22456d6f49dae8669 to udc-release am: c30791a55e Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/22724215 Change-Id: I27cda063be859b18f8d48c60e8c368ef6b114294 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();