Skip to main content

luaur_analysis/functions/
drop_while.rs

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