commit | c6b4eb7f498c8d509a55da35fcedf0d673fc5fc5 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Mon Mar 28 22:05:04 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Mon Mar 28 22:05:04 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | 76557f5a2452262bcabcc58ff54db5a3c0839c88 [diff] | |
parent | 1e8a1d8a2c192e998b687bfbe82a873a9cd17a47 [diff] |
Snap for 8370592 from 1e8a1d8a2c192e998b687bfbe82a873a9cd17a47 to t-keystone-qcom-release Change-Id: I5477d281f6bd054afcc4dc6f50ff69c18d5bf1ca
"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();