commit | c3292f228d50b71699d3ac8b94e23bde991ef0ff | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Fri Mar 10 05:17:49 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Fri Mar 10 05:17:49 2023 +0000 |
tree | ea4d3887b79c5a775c7539378ee2bf3a7838ca06 | |
parent | d701e3772d4c745dab1550c84bd4d2ccaf4c157b [diff] | |
parent | 6b4608975aa3c0a619c856ce42563a6b5f5686fe [diff] |
Snap for 9722771 from 6b4608975aa3c0a619c856ce42563a6b5f5686fe to udc-d1-release Change-Id: I1700b604511945738a1cbd69ebb657f993b139be
“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();