commit | d151c0379566290158db83c8213767a5937ea9f0 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Tue Feb 07 02:20:06 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Tue Feb 07 02:20:06 2023 +0000 |
tree | e7ccbbbfb133da56e0cac7a08cc21948ffe3ab7d | |
parent | 8c3669ac2d4606b7a0003bb8b6186dfda44d4935 [diff] | |
parent | c004a69014a9474ebfcfa357d7a3afefbf7d78bd [diff] |
Snap for 9569386 from c004a69014a9474ebfcfa357d7a3afefbf7d78bd to udc-release Change-Id: Ia0779f4427a1bc1390002479a28c8a256fc06f5d
“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();