nybbles

Function smallvec_with

Source
pub unsafe fn smallvec_with<const N: usize>(
    len: usize,
    f: impl FnOnce(&mut [MaybeUninit<u8>]),
) -> SmallVec<[u8; N]>
Expand description

Initializes a smallvec with the given length and a closure that initializes the buffer.

Optimized version of SmallVec::with_capacity + f() + .set_len.

ยงSafety

The closure must fully initialize the buffer with the given length.