commit | f0c28cc5df7e1ab15db3b1f17f852b3a9267b167 | [log] [tgz] |
---|---|---|
author | Jeff Vander Stoep <jeffv@google.com> | Thu Nov 05 15:27:54 2020 +0100 |
committer | Jeff Vander Stoep <jeffv@google.com> | Thu Nov 05 15:27:54 2020 +0100 |
tree | 5b081fe46bd8d5f84c1fcfcf68c07003059a4866 | |
parent | 4c2fb019b8fc52d2bfdf976d06c8641b4c0e4c51 [diff] |
TEST_MAPPING: test dependers of this crate Bug: 168167373 Test: TH Change-Id: I4fa0c66638d1eecbb96d466cae5b4a576f1cc970
“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();