commit | c35cd24066593df6b72b3f1d3006f0ddb0bd0978 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Tue Sep 29 17:57:56 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Sep 29 17:57:56 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | c361e3e4c7557d9a5dcc88f24db36bc3d5dc51a2 [diff] | |
parent | f575d2366e23947838ce8d44df33dcd0c624c9ad [diff] |
Merge "Upgrade rust/crates/smallvec to 1.4.2" am: 5237030d92 am: 2b62ce0785 am: c0ccb926b3 am: f575d2366e Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1397507 Change-Id: Icecfed9463143a1010e08e8596ea54128fc8d2ce
"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();