VecExtensions

Trait VecExtensions 

Source
pub trait VecExtensions<T> {
    // Required method
    fn retain_mut_ext<F>(&mut self, f: F)
       where F: FnMut(&mut T) -> bool;
}

Required Methods§

Source

fn retain_mut_ext<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Retains only the elements specified by the predicate.

In other words, remove all elements e such that f(&mut e) returns false. This method operates in place, visiting each element exactly once in the original order, and preserves the order of the retained elements.

§Notes

This method is the copy of retain method of Vec, but with ability to modify each element.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> VecExtensions<T> for Vec<T>

Source§

fn retain_mut_ext<F>(&mut self, f: F)
where F: FnMut(&mut T) -> bool,

Implementors§