Trait array_tool::vec::Intersect [] [src]

pub trait Intersect<T> {
    fn intersect(&self, _: Self) -> Self;
fn intersect_if<F: Fn(&T, &T) -> bool>(&self, _: Self, validator: F) -> Self; }

Set Intersection — Returns a new array containing elements common to the two arrays, excluding any duplicates. The order is preserved from the original array.

Required Methods

Example

use array_tool::vec::Intersect;

vec![1,1,3,5].intersect(vec![1,2,3]);

Output

vec![1,3]

Example

use array_tool::vec::Intersect;

vec!['a','a','c','e'].intersect_if(vec!['A','B','C'], |l, r| l.eq_ignore_ascii_case(r));

Output

vec!['a','c']

Implementations on Foreign Types

impl<T: PartialEq + Clone> Intersect<T> for Vec<T>
[src]

[src]

[src]

Implementors