commit | 9becc054547f582fb5875ca6e98e490282e8bbf1 | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <[email protected]> | Mon Oct 12 10:52:41 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Mon Oct 12 10:52:41 2020 +0000 |
tree | 16f523326e689c31f4fb5f52bbf0417faf76233b | |
parent | 199741f76fdea652c7fe6323385705eb28c6f3eb [diff] | |
parent | 736efd0f99ba5a80522a6bf479f9ab1f17ca5d5c [diff] |
Copy description from Cargo.toml to METADATA am: 0e60726f90 am: 4c2fb019b8 am: 736efd0f99 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1456780 Change-Id: I8a1f22eeb27c305f49eac7e1a23adb43efae9f0e
“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();