commit | 2c43427c2f1fdc0208df147cc9a3dd8417789943 | [log] [tgz] |
---|---|---|
author | Linux Build Service Account <lnxbuild@localhost> | Fri Apr 15 20:08:25 2022 -0700 |
committer | Linux Build Service Account <lnxbuild@localhost> | Fri Apr 15 20:08:25 2022 -0700 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | a7772e1d9cd1fa733cb3a9f14a2140722748001e [diff] | |
parent | c6b4eb7f498c8d509a55da35fcedf0d673fc5fc5 [diff] |
Merge c6b4eb7f498c8d509a55da35fcedf0d673fc5fc5 on remote branch Change-Id: I1cb5d90c1e6b882d7ecadb5570a583165724e54e
"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();