commit | 1c295cce4d8f88bf89b722d0b60c0f519b6edf63 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Dec 22 11:19:50 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Dec 22 11:19:50 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | c6b4eb7f498c8d509a55da35fcedf0d673fc5fc5 [diff] | |
parent | 4682fe1d907207c8132907405fd81b5508c435ee [diff] |
Snap for 9430503 from 4682fe1d907207c8132907405fd81b5508c435ee to t-keystone-qcom-release Change-Id: Ia2c00c7b970bb0946d2767055524fec23b7e0918
"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();