commit | ac24ff21446946814ef55de44ca52e5c0be9ac89 | [log] [tgz] |
---|---|---|
author | Treehugger Robot <[email protected]> | Tue Mar 08 21:25:28 2022 +0000 |
committer | Automerger Merge Worker <[email protected]> | Tue Mar 08 21:25:28 2022 +0000 |
tree | 8a0aaf450d87ced0b38394bff96d3d54d2ee92be | |
parent | 38a95dd734eb4e673047a2fd4b9943a2cdd921d6 [diff] | |
parent | 3d0e7105d4fa7b048b5beeec66b8f6caf7c2816b [diff] |
Merge "Update smallvec to 1.8.0" am: 2b8efd428c am: 3d0e7105d4 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/2004421 Change-Id: I2161ea8a48db4249effa6baee5ec05fc2178e3d1
“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();