retain_mut

Trait RetainMut

Source
pub trait RetainMut<T> {
    // Required method
    fn retain_mut<F>(&mut self, f: F)
       where F: FnMut(&mut T) -> bool;
}
👎Deprecated: Rust 1.61 has included retain_mut directly
Expand description

Trait that provides retain_mut method.

Required Methods§

Source

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

👎Deprecated: Rust 1.61 has included retain_mut directly

Retains only the elements specified by the predicate, passing a mutable reference to it.

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.

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> RetainMut<T> for VecDeque<T>

Source§

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

👎Deprecated: Rust 1.61 has included retain_mut directly
Source§

impl<T> RetainMut<T> for Vec<T>

Source§

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

👎Deprecated: Rust 1.61 has included retain_mut directly

Implementors§