commit | c62d25ec3e666d7b3d0489593fe3e6025886f00c | [log] [tgz] |
---|---|---|
author | Xin Li <[email protected]> | Wed Nov 25 03:20:08 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Wed Nov 25 03:20:08 2020 +0000 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | ba5a15e5ea14eab259a05726f1cc8e4ca28c82cf [diff] | |
parent | c9b20fca295c883c26a3f09d45431e090fb33416 [diff] |
Mark ab/6881855 as merged am: c9b20fca29 Original change: https://googleplex-android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/13112903 Change-Id: Ib1995bab25327524c008ae00be310a764aa19f18
“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();