commit | 68fddd55b7f487b56ddeef294a5d2f2c6b00f640 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Tue Sep 29 18:33:39 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Sep 29 18:33:39 2020 +0000 |
tree | 016def8e169faec1a21e319a82de77ec852c2ccd | |
parent | c615b964b39adbfed2d5a3461d043f2c6e94b5d2 [diff] | |
parent | c35cd24066593df6b72b3f1d3006f0ddb0bd0978 [diff] |
Merge "Upgrade rust/crates/smallvec to 1.4.2" am: 5237030d92 am: 2b62ce0785 am: c0ccb926b3 am: f575d2366e am: c35cd24066 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1397507 Change-Id: I06b663d4ec2324bc9de4efe7391f629e498dd7c8
“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();