commit | 2b2231c2c1a14660dcf8c08072cc1347287a2262 | [log] [tgz] |
---|---|---|
author | James Farrell <jamesfarrell@google.com> | Fri Aug 30 03:38:54 2024 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Fri Aug 30 03:38:54 2024 +0000 |
tree | 4ccc9609d29c6f2484dc04b212e0e378d43ca51c | |
parent | 394b8518b664af003db3472a621d679de11f91bc [diff] | |
parent | eacd22262177aeb514bb3bd936876492be6d9084 [diff] |
Migrate 25 crates to monorepo. am: eacd222621 Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/smallvec/+/3249090 Change-Id: I44fd7555d6dc3e5201a630070695e19dd9695d58 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
“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();