[][src]Trait retain_mut::RetainMut

pub trait RetainMut<T> {
    fn retain_mut<F>(&mut self, f: F)
    where
        F: FnMut(&mut T) -> bool
; }

Trait that provides retain_mut method.

Required Methods

Retains only the elements specified by the predicate with a mutable borrow.

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

Examples

use retain_mut::RetainMut;

let mut vec = vec![1, 2, 3, 4];
vec.retain_mut(|x| { *x *= 3; *x % 2 == 0 });
assert_eq!(vec, [6, 12]);

Implementations on Foreign Types

impl<T> RetainMut<T> for Vec<T>
[src]

Implementors