commit | 76898e1b6c76d820dc52d6fe906eca754cd69a5b | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Dec 13 00:13:22 2023 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Wed Dec 13 00:13:22 2023 +0000 |
tree | 85bba2898c7ba5b053d723b80a04dee78593f109 | |
parent | da0204538c9e9c869edd90009d8b09c054a56fca [diff] | |
parent | 5d9d02fb0ff17b83d0384d5a0e2389a8d4759c7e [diff] |
Snap for 11211409 from 5d9d02fb0ff17b83d0384d5a0e2389a8d4759c7e to sdk-release Change-Id: I73b3f7763edc9e864c3ae8b9ca11c94624f0d6fb
“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();