[−][src]Function iter_set::union
pub fn union<T, L, R>(a: L, b: R) -> impl Iterator<Item = T> where
T: Ord,
L: IntoIterator<Item = T>,
R: IntoIterator<Item = T>,
Take the union of two sets represented by sorted, deduplicated iterators.
If an element is in both iterators, then only the one from a
is yielded.
This behaviour can be overridden by using union_by
.
Time complexity: O(a.len() + b.len())
.
Examples
use iter_set::union; let a = [1, 2]; let b = [2, 3]; assert!(union(&a, &b).eq(&[1, 2, 3]));