commit | 4c2fb019b8fc52d2bfdf976d06c8641b4c0e4c51 | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <[email protected]> | Mon Oct 12 09:45:01 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Mon Oct 12 09:45:01 2020 +0000 |
tree | 16f523326e689c31f4fb5f52bbf0417faf76233b | |
parent | 00867e8870e57c3fc8f93a16a1119f36f62ad297 [diff] | |
parent | 0e60726f906377259a8c88f69291b7bbbe00d45d [diff] |
Copy description from Cargo.toml to METADATA am: 0e60726f90 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1456780 Change-Id: I0d6b7a3c405eb37cc74136777d92956707eede47
“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();