commit | e691a6414898fadc2d0e2b7c3da75c6cf9e46fde | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 10 01:05:42 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Mar 10 01:05:42 2022 +0000 |
tree | 8a0aaf450d87ced0b38394bff96d3d54d2ee92be | |
parent | 46978637ec34d46fb12677d194f585a38eb0efea [diff] | |
parent | 65a04b3848f2128a6672e97d66b951b683d37f53 [diff] |
Snap for 8283691 from 65a04b3848f2128a6672e97d66b951b683d37f53 to tm-d1-release Change-Id: I39bcc23fb6177788d83c5b2833711b4120458511
“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();