commit | 12905cced09a9dbd70f6dcf932cc8a29c16ee940 | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Thu Nov 05 17:29:14 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Nov 05 17:29:14 2020 +0000 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | f9fa0dd56809f68b3341fbcac9f4ee08ac90c392 [diff] | |
parent | ba5a15e5ea14eab259a05726f1cc8e4ca28c82cf [diff] |
TEST_MAPPING: test dependers of this crate am: f0c28cc5df am: 07e1b85001 am: 8f98242090 am: ba5a15e5ea Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1488808 Change-Id: I1cb852fe7708412db6e180311bc7f99ea8251b3d
“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();