commit | 6d91895eaa5bba238a96b815cbce766dc3c9e89d | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Sat May 11 01:14:41 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Sat May 11 01:14:41 2024 +0000 |
tree | f7a5fda58e86abf9d474f8fe19b4356d33fe1039 | |
parent | 5b741b0353aca6827263820c080d703db859400a [diff] | |
parent | 9a30136c1d4f0aea393b7696559bd8424a37af11 [diff] |
Snap for 11828632 from 9a30136c1d4f0aea393b7696559bd8424a37af11 to 24Q3-release Change-Id: Ia0965b7da57b4674d4f9439e09c0c9ef6262dc35
“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();