commit | 85e0432e0b6c63a3194bd30bbf14fc5f2eb41ab4 | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 15 12:07:46 2023 -0800 |
committer | Linux Build Service Account <lnxbuild@localhost> | Sun Jan 15 12:07:46 2023 -0800 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | 2c43427c2f1fdc0208df147cc9a3dd8417789943 [diff] | |
parent | 1c295cce4d8f88bf89b722d0b60c0f519b6edf63 [diff] |
Merge 1c295cce4d8f88bf89b722d0b60c0f519b6edf63 on remote branch Change-Id: I4c19f082783e7066dc3ce40efcb7f3d37fc63df5
"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();