commit | 0038b53a555404c9617bc3d641b2ce3ce410839b | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Wed Apr 19 01:23:21 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Wed Apr 19 01:23:21 2023 +0000 |
tree | 40c1ec7f8824c6f65686d9ffb768102f82961542 | |
parent | c3292f228d50b71699d3ac8b94e23bde991ef0ff [diff] | |
parent | 2b3b380f35784c6c684cd9abfd89895a1b66a65d [diff] |
Snap for 9966320 from 2b3b380f35784c6c684cd9abfd89895a1b66a65d to udc-d1-release Change-Id: I281f7ea3bc09a41382b2fd38d6245a438de669da
“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();