commit | 5986c40c21100f7fe0f624ea3969fe2b5dedba7d | [log] [tgz] |
---|---|---|
author | Chih-Hung Hsieh <chh@google.com> | Wed Sep 16 17:53:48 2020 -0700 |
committer | Chih-Hung Hsieh <chh@google.com> | Wed Sep 16 17:53:48 2020 -0700 |
tree | a523801b123356fbffb3eec4d9a9e90aae21391d | |
parent | 96174d02d72c501acba134d91caa3ad4fd977604 [diff] |
Add smallvec/OWNERS Test: make Change-Id: I76fbe76ccc0b819fc0c33e268c806a26408ce0a5
“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();