commit | 0d9862f4f9c8d9c0c4bde413853e067126782048 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri May 10 15:42:30 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Fri May 10 15:42:30 2024 +0000 |
tree | 9d9548529b260bac4bd6063fc336192fadb522d7 | |
parent | 5188a9fce30c5d762e2c59c39251cfffdd9af6e0 [diff] | |
parent | 4a0e2f7628fbbf3c73fbd4ba055e00806d222c05 [diff] |
Snap for 11819167 from 4a0e2f7628fbbf3c73fbd4ba055e00806d222c05 to busytown-mac-infra-release Change-Id: I52c4a5d54f4ed55e8389c9dc63605a99c717a21a
“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();