commit | 242eb5a701bb2e4b34ed2d4adecacdbf36d98e13 | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 16 14:31:47 2022 -0800 |
committer | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 16 14:31:47 2022 -0800 |
tree | 3ed4f71564f78fb702412335da032629712bf1f3 | |
parent | 227adb613447fb819b190e27deadcb560addda2c [diff] | |
parent | ff94fe370a57e7952fdca0b3efc7a9acb11b5718 [diff] |
Merge ff94fe370a57e7952fdca0b3efc7a9acb11b5718 on remote branch Change-Id: Iaef1e10becac2a1b23678071d48c4dfb32887256
"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();