commit | 95ffdd598597ff7a1d8ad0e5468b3b261ba28895 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Thu Jun 09 07:12:33 2022 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Thu Jun 09 07:12:33 2022 +0000 |
tree | da86de748981dd96113865df11834b360d9da02b | |
parent | 42b4be4065503a3bd26564342631060cc2886b0b [diff] | |
parent | dd67dd31f83d56d34f933f3ff0204baa55a68aac [diff] |
Snap for 8701348 from dd67dd31f83d56d34f933f3ff0204baa55a68aac to mainline-uwb-release Change-Id: I2e1182a890e2ecb7f6e01d994d879ea8cbcc906f
“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();