commit | c53273b37359ea182f076766763367afeb2246b3 | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Fri Sep 18 01:15:00 2020 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Fri Sep 18 01:15:00 2020 +0000 |
tree | a523801b123356fbffb3eec4d9a9e90aae21391d | |
parent | ee0e35e91f6dffe4078bb169ab2e6f701e42bf46 [diff] | |
parent | c615b964b39adbfed2d5a3461d043f2c6e94b5d2 [diff] |
Snap for 6845284 from c615b964b39adbfed2d5a3461d043f2c6e94b5d2 to sc-release Change-Id: If845e19cfa2aa4f3c08e94e5ca57042ecc163e82
"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();