Skip to main content

reserve_capped

Function reserve_capped 

Source
fn reserve_capped(bytes: &mut Vec<u8>, want: usize, limit: usize)
Expand description

Reserve want more bytes, growing geometrically but never past limit.

want is expected to be clamped to the remaining budget by the caller; a larger value is honored rather than dropped, since refusing to reserve it would only move the allocation into the following extend_from_slice.