commit | 76fb73fd7205cf96cf8be7c6e1b8a8906be03390 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 10 02:06:04 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 10 02:06:04 2022 +0000 |
tree | 8a0aaf450d87ced0b38394bff96d3d54d2ee92be | |
parent | 866a27943519c91189e9edfe4b723c8cdc509000 [diff] | |
parent | 65a04b3848f2128a6672e97d66b951b683d37f53 [diff] |
Snap for 8283941 from 65a04b3848f2128a6672e97d66b951b683d37f53 to tm-release Change-Id: Ia889fde44a24c4df529c2f6ff2dadbe704a2affb
"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();