commit | 04d5b4db36ccad993f94437d4b9bfe93ae63c9f7 | [log] [tgz] |
---|---|---|
author | android-build-team Robot <android-build-team-robot@google.com> | Fri Nov 06 02:10:41 2020 +0000 |
committer | android-build-team Robot <android-build-team-robot@google.com> | Fri Nov 06 02:10:41 2020 +0000 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | 3db7f52ed45abd44c6cca79960ef2cab1b029565 [diff] | |
parent | 12905cced09a9dbd70f6dcf932cc8a29c16ee940 [diff] |
Snap for 6955520 from 12905cced09a9dbd70f6dcf932cc8a29c16ee940 to sc-release Change-Id: I2817666640db135f2f82ccb236a884b38e5c8985
"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();