commit | b10db42899210ab5ec2bc0c2c6ba93d49d8f60a3 | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Wed Feb 17 04:04:51 2021 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Wed Feb 17 04:04:51 2021 +0000 |
tree | 301fc457c178d7a6e8031eb136d7bf951a404406 | |
parent | 2a9f07d834d5e5900bf8dd6446c2c70e610d0f2b [diff] | |
parent | 004bfcc27519d99d50e446fd68158141d37ffe10 [diff] |
Snap for 7150039 from 004bfcc27519d99d50e446fd68158141d37ffe10 to tm-release Change-Id: I374f775524a3bd18699082a0bed5cc73b8987d32
"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();