commit | c361e3e4c7557d9a5dcc88f24db36bc3d5dc51a2 | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <[email protected]> | Thu Sep 17 14:11:19 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Sep 17 14:11:19 2020 +0000 |
tree | a523801b123356fbffb3eec4d9a9e90aae21391d | |
parent | 1fb67a1e461b30b5cdbd5d17c51a65edc7013ce2 [diff] | |
parent | 61884b4153340916ce0a57c5eb6e76c4466bd044 [diff] |
Add smallvec/OWNERS am: 5986c40c21 am: ce62492438 am: 7302d7a516 am: 61884b4153 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1429448 Change-Id: I8e36f6b3e62c9113e1a76bc57f227a71d0c40ba7
“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();