commit | 8fdfb5b044c2c0ac8e3bc914055942af426e1142 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Feb 06 13:57:35 2024 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Tue Feb 06 13:57:35 2024 +0000 |
tree | 9d9548529b260bac4bd6063fc336192fadb522d7 | |
parent | 76898e1b6c76d820dc52d6fe906eca754cd69a5b [diff] | |
parent | 1f97ab5903fcfb0091eca80996ccf69ba5735e2a [diff] |
Snap for 11411398 from 1f97ab5903fcfb0091eca80996ccf69ba5735e2a to sdk-release Change-Id: Icdd9deb6de2881032bfcb1f6403fceb93ade0744
“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();