commit | 2b62ce0785c8f9cdf33031fd008de363c1bff203 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <treehugger-gerrit@google.com> | Tue Sep 29 16:34:09 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Sep 29 16:34:09 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | ce62492438c4c4f401dd9402b01555270b79a204 [diff] | |
parent | 5237030d92994002c7adc200089887593fcf2b4b [diff] |
Merge "Upgrade rust/crates/smallvec to 1.4.2" am: 5237030d92 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1397507 Change-Id: I2dd989f7adda088b4eefebb32a21f118c2c91279
“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();