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