commit | 3e0133f4229ea98d3f4626e69b2f34a3dd788129 | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Wed Sep 30 03:02:10 2020 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Wed Sep 30 03:02:10 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | 88f4b7bfa0df0c7284b17a61c8b65e0c953789e3 [diff] | |
parent | 87c967db9934c785d4b4af2216737c174404a57b [diff] |
Snap for 6873266 from 87c967db9934c785d4b4af2216737c174404a57b to sc-d1-release Change-Id: I9ca225ecf3a36b7b733bd9a78ffdd1adc1811af2
"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();