commit | 7302d7a516c1308d0bda36812e4b2eff36e8815d | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Thu Sep 17 07:36:30 2020 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Thu Sep 17 07:36:30 2020 +0000 |
tree | a523801b123356fbffb3eec4d9a9e90aae21391d | |
parent | 6a25e1f61f6ff50d6df1d257ca09547208b18ddc [diff] | |
parent | ce62492438c4c4f401dd9402b01555270b79a204 [diff] |
Add smallvec/OWNERS am: 5986c40c21 am: ce62492438 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1429448 Change-Id: I8ae995346f3cd35287993b60d05bd30731cc7edf
“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();