commit | 227adb613447fb819b190e27deadcb560addda2c | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Wed Jun 09 03:00:40 2021 -0700 |
committer | Linux Build Service Account <lnxbuild@localhost> | Wed Jun 09 03:00:40 2021 -0700 |
tree | 3ed4f71564f78fb702412335da032629712bf1f3 | |
parent | cbe40fd608e8744b920a6d4955c3db6b5a4e68d9 [diff] | |
parent | 19b6113cfb239d117a1f06338ff2cca387cf2402 [diff] |
Merge 19b6113cfb239d117a1f06338ff2cca387cf2402 on remote branch Change-Id: I42dc62f0722867ec77d4e5245894c2f5efbc54e2
"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();