commit | 2a9f07d834d5e5900bf8dd6446c2c70e610d0f2b | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Mon Jan 18 10:50:33 2021 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Mon Jan 18 10:50:33 2021 +0000 |
tree | 948c9bc56f9ce16be561120f57f06102000cad52 | |
parent | 2f652d2ca57fd625094cac475b03cb7fe1fb4b17 [diff] | |
parent | 86ef446a7618fdd87bcbbd9c1fa84b1095005fb0 [diff] |
Snap for 7088030 from 86ef446a7618fdd87bcbbd9c1fa84b1095005fb0 to tm-release Change-Id: If1f881ac72cd8881d3a3ffd7e31e5b7c475191f3
"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();