commit | ba5a15e5ea14eab259a05726f1cc8e4ca28c82cf | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <[email protected]> | Thu Nov 05 17:20:18 2020 +0000 |
committer | Automerger Merge Worker <[email protected]> | Thu Nov 05 17:20:18 2020 +0000 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | 9becc054547f582fb5875ca6e98e490282e8bbf1 [diff] | |
parent | 8f982420904ee2c56020bb2b93ad6be4e89268de [diff] |
TEST_MAPPING: test dependers of this crate am: f0c28cc5df am: 07e1b85001 am: 8f98242090 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/1488808 Change-Id: I04198365fd259ebd309ecd8a6250e9db9202f698
“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();