commit | 00003e8e8fcafcfd790f6c78eb389b2ef210dd8a | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Tue Feb 16 22:08:47 2021 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Feb 16 22:08:47 2021 +0000 |
tree | 301fc457c178d7a6e8031eb136d7bf951a404406 | |
parent | 2d75ee73757afe796d25590f41c4ce5d9767ff63 [diff] | |
parent | 8624c24b12cc39237fe366000ac00600bdc825df [diff] |
Merge "[LSC] Add LOCAL_LICENSE_KINDS to external/rust/crates/smallvec" am: da1557c4d0 am: c37fb7ee60 am: 8624c24b12 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1588753 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I9781f64f68de27cf0599645d372fca36d9dec683
“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();