[−][src]Function iter_set::intersection
pub fn intersection<T, L, R>(a: L, b: R) -> impl Iterator<Item = T> where
T: Ord,
L: IntoIterator<Item = T>,
R: IntoIterator<Item = T>,
Take the intersection of two sets represented by sorted, deduplicated iterators.
The elements returned will all be from a
. This behaviour can be overridden by
using intersection_by
.
Time complexity: O(a.len() + b.len())
.
Examples
use iter_set::intersection; let a = [1, 2]; let b = [2, 3]; assert!(intersection(&a, &b).eq(&[2]));