commit | b9330f0c56e6a7994bd421b0b722496b28b7bd89 | [log] [tgz] |
---|---|---|
author | Haibo Huang <hhb@google.com> | Tue Aug 11 18:27:35 2020 -0700 |
committer | Joel Galenson <jgalenson@google.com> | Mon Sep 28 16:23:08 2020 -0700 |
tree | 8d47b702b6ae19227400d2a247851c68ac796059 | |
parent | 96174d02d72c501acba134d91caa3ad4fd977604 [diff] |
Upgrade rust/crates/smallvec to 1.4.2 Test: None Change-Id: I26b4cef675b3dba23235131a9d33d46372c06d9c
“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();