commit | ff94fe370a57e7952fdca0b3efc7a9acb11b5718 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Mon Dec 20 11:05:18 2021 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Mon Dec 20 11:05:18 2021 +0000 |
tree | 3ed4f71564f78fb702412335da032629712bf1f3 | |
parent | 19b6113cfb239d117a1f06338ff2cca387cf2402 [diff] | |
parent | fe6c058465d623f386d0f345f9966185fbf55fde [diff] |
Snap for 8014993 from fe6c058465d623f386d0f345f9966185fbf55fde to s-keystone-qcom-release Change-Id: Ic6507daa78d86d135513a4460602feac94d08451
"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();