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