1 2 3 4 5 6 7 8 9 10 11 12
pub fn drop_while<T, P>(vec: &mut alloc::vec::Vec<T>, pred: P) where P: Fn(&T) -> bool, { let mut it = 0; while it < vec.len() && pred(&vec[it]) { it += 1; } if it > 0 { vec.drain(0..it); } }