commit | c183083fdec3a03857fea2e99dee43c84218a7b3 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu Mar 17 01:05:42 2022 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu Mar 17 01:05:42 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | e691a6414898fadc2d0e2b7c3da75c6cf9e46fde [diff] | |
parent | 638d0ee87b2ef1082fe674e75f89932b179fe32a [diff] |
Snap for 8310722 from 638d0ee87b2ef1082fe674e75f89932b179fe32a to tm-d1-release Change-Id: I8faec53f256876c89755d7832cec0bfab4283b6f
“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();