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