commit | c016376ae29a3f9cd7ff5d95e04d0478d2bb7269 | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Sun Feb 21 02:05:13 2021 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Sun Feb 21 02:05:13 2021 +0000 |
tree | 301fc457c178d7a6e8031eb136d7bf951a404406 | |
parent | b10db42899210ab5ec2bc0c2c6ba93d49d8f60a3 [diff] | |
parent | 5c83c5df3a6bc3d2ecd8c229313937e68a4a56fd [diff] |
Snap for 7160100 from 5c83c5df3a6bc3d2ecd8c229313937e68a4a56fd to tm-release Change-Id: I5f5c8e64cc3040b8d9d73c326b6844cfd54fcb6f
"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();