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