pub fn to_vec_with_capacity<T: Serialize>(
value: &T,
capacity: usize,
) -> Result<Vec<u8>, JsonError>Expand description
Serialize a value to a JSON byte vector with pre-allocated capacity.
Use this when you have a good estimate of the output size to avoid reallocations.