commit | f14c9fb2a012e9627636b447f52d88ae572f074c | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu May 23 23:15:12 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu May 23 23:15:12 2024 +0000 |
tree | 7872e8d542897450d9a437be1d1a3c7308e08b19 | |
parent | 6d91895eaa5bba238a96b815cbce766dc3c9e89d [diff] | |
parent | 4f277b70dc1536d099ad9020f1f9edb04c0f44de [diff] |
Snap for 11881322 from 4f277b70dc1536d099ad9020f1f9edb04c0f44de to 24Q3-release Change-Id: I964a6c788c10aa9bb7fa45526d225011c0c9b737
“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();