commit | 0ab4a1d25db800e84e33cd88b47f7a529c414be6 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Oct 28 17:30:45 2021 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Oct 28 17:30:45 2021 +0000 |
tree | 0c9124e5458bc7501f3104afc5f4bdf2e0db1bd1 | |
parent | 0f55a2a5caeac137effaaadd806355478353f693 [diff] | |
parent | 5765406641db463640641bd89d75260aa00f6126 [diff] |
Snap for 7862349 from 5765406641db463640641bd89d75260aa00f6126 to t-keystone-qcom-release Change-Id: Ifde341d76f8f83d58779964f5615b810c9cf3769
"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();