pub fn split_vec_min_alloc<T>(vec: &mut Vec<T>, n: usize) -> Vec<T>Expand description
Splits vec at index n, returning the first n elements and leaving the
remaining vec.len() - n elements in vec.
Allocates for whichever side is smaller, so the new allocation is
min(n, vec.len() - n) rather than always n (as vec.drain(0..n).collect()
would). This matters when the split emits a prefix under memory pressure,
where n can be close to vec.len().