commit | 13b8b26dc76cd7d87a7244817729d52c06caf17f | [log] [tgz] |
---|---|---|
author | Xin Li <delphij@google.com> | Wed Jun 02 16:50:52 2021 +0000 |
committer | Xin Li <delphij@google.com> | Wed Jun 02 16:50:52 2021 +0000 |
tree | 49b6ff005e50a5361a721ac1a73e84d5e4526af4 | |
parent | 31e381f1ca44a274eab579abb7b3444b06c2dd85 [diff] | |
parent | 06b926d5af978a3f55ee650204905ae411407b64 [diff] |
Merge sc-mainline-prod Bug: 189946434 Change-Id: I5e1bb33ac48d355072ce784fb907cfaa878023fb
"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();