commit | cb506a611143276430d040401677e834b207793f | [log] [tgz] |
---|---|---|
author | android-build-prod (mdb) <android-build-team-robot@google.com> | Fri Jan 29 07:29:45 2021 +0000 |
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | Fri Jan 29 07:29:45 2021 +0000 |
tree | 948c9bc56f9ce16be561120f57f06102000cad52 | |
parent | 5237030d92994002c7adc200089887593fcf2b4b [diff] | |
parent | 6dadc1b1a35da63eb97b56a0593e043fb9b7fa6c [diff] |
Snap for 7110675 from 6dadc1b1a35da63eb97b56a0593e043fb9b7fa6c to sdk-release Change-Id: I111b69dd8bfb1742c4e4f9ea89144d26f5d76324
“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();