RetainTake

Trait RetainTake 

Source
pub trait RetainTake<T> {
    // Required method
    fn retain_take<F>(&mut self, predicate: F) -> Vec<T>
       where F: FnMut(&T) -> bool;
}
Available on crate feature alloc only.
Expand description

The retain+take operation is exactly what it sounds like. Retain only those elements that match the predicate, but return whole owned copies of the items. For efficiency’s sake, some implementations may iterate backwards through the container.

Required Methods§

Source

fn retain_take<F>(&mut self, predicate: F) -> Vec<T>
where F: FnMut(&T) -> bool,

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

Source§

fn retain_take<F>(&mut self, predicate: F) -> Vec<T>
where F: FnMut(&T) -> bool,

Source§

impl<T> RetainTake<T> for Vec<T>

Source§

fn retain_take<F>(&mut self, predicate: F) -> Vec<T>
where F: FnMut(&T) -> bool,

Implementors§