commit | 07e1b850019fd974cc9047ac6412aadc1ce49e45 | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <jeffv@google.com> | Thu Nov 05 16:20:36 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Nov 05 16:20:36 2020 +0000 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | 4c2fb019b8fc52d2bfdf976d06c8641b4c0e4c51 [diff] | |
parent | f0c28cc5df7e1ab15db3b1f17f852b3a9267b167 [diff] |
TEST_MAPPING: test dependers of this crate am: f0c28cc5df Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1488808 Change-Id: Ibf94c56b58d1dbf386ee30a6ee00ff96d185bec1
"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();