commit | eacd22262177aeb514bb3bd936876492be6d9084 | [log] [tgz] |
---|---|---|
author | James Farrell <[email protected]> | Thu Aug 29 16:49:57 2024 +0000 |
committer | James Farrell <[email protected]> | Thu Aug 29 16:49:57 2024 +0000 |
tree | 4ccc9609d29c6f2484dc04b212e0e378d43ca51c | |
parent | 89d5aa586309e3e7124349eac1da041c1bf03e03 [diff] |
Migrate 25 crates to monorepo. sec1 semver serde_cbor serde_derive shared_library slab smallvec smccc socket2 spin spki strsim strum strum_macros sync_wrapper syn-mid synstructure tempfile termcolor termtree textwrap thiserror thread_local tinytemplate tokio-macros Bug: 339424309 Test: treehugger Change-Id: I6cb0841f8406fa4ec80c04443a7dee880e79afc7
“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();