commit | c846adc02284c5ae542780d01f340c957bf69ff4 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Sat Aug 31 01:15:10 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Sat Aug 31 01:15:10 2024 +0000 |
tree | 4ccc9609d29c6f2484dc04b212e0e378d43ca51c | |
parent | eae5cc3a693034ae1a044b855354a6947cf28c8f [diff] | |
parent | e320b8566b1de46fd11f2ccf0d2823128b119dcb [diff] |
Snap for 12304452 from e320b8566b1de46fd11f2ccf0d2823128b119dcb to 24Q4-release Change-Id: Ie43e4e77f618513d7db177fd928be36ee8f50bdc
“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();