commit | 96978bad2daed7504e9ed38c8276b0c5b51eee47 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu Sep 12 19:42:20 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu Sep 12 19:42:20 2024 +0000 |
tree | 6efa95f63d3555804589e641ae94d9515d6276c9 | |
parent | f14c9fb2a012e9627636b447f52d88ae572f074c [diff] | |
parent | 27080cf85d340dbcfae158b295c5d724af40811e [diff] |
Snap for 12359238 from 27080cf85d340dbcfae158b295c5d724af40811e to android15-tests-release Change-Id: I7f0c713575045514c5c05b897c693e4127b17a08
“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();