commit | c441b89c249e8c54dc424f792cf78f45ea9aecd6 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Fri Mar 10 02:22:27 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Fri Mar 10 02:22:27 2023 +0000 |
tree | ea4d3887b79c5a775c7539378ee2bf3a7838ca06 | |
parent | d151c0379566290158db83c8213767a5937ea9f0 [diff] | |
parent | 6a99587c552c521c589581aea3492460e7c5038a [diff] |
Snap for 9719949 from 6a99587c552c521c589581aea3492460e7c5038a to udc-release Change-Id: I114c5202d7ba8ddeb9305e80b880f63a3465c4dd
“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();