fn write_to_spare_capacity_of_vec<T>(
    output: &mut Vec<u8>,
    writer: impl FnOnce(&mut [u8]) -> (usize, T)
) -> T
Expand description

Allows writer to write data into the spare capacity of the output vector. This will not reallocate the vector provided or attempt to grow it, so space for the output must be reserved by the caller before calling this function.

writer needs to return the number of bytes written (and can also return another arbitrary return value).