pub trait MultiwaySortedDisjoint<T: Integer, I>: IntoIterator<Item = I> + Sizedwhere
I: SortedDisjoint<T>,{
// Provided methods
fn union(self) -> UnionKMerge<T, I> { ... }
fn intersection(self) -> NotIter<T, UnionKMerge<T, NotIter<T, I>>> ⓘ { ... }
fn symmetric_difference(self) -> SymDiffKMerge<T, I> { ... }
}Expand description
Provides methods on zero or more SortedDisjoint iterators,
specifically union, intersection, and symmetric_difference.
Provided Methods§
Sourcefn union(self) -> UnionKMerge<T, I>
fn union(self) -> UnionKMerge<T, I>
Unions the given SortedDisjoint iterators, creating a new SortedDisjoint iterator.
The input iterators must be of the same type. Any number of input iterators can be given.
For input iterators of different types, use the union_map_dyn! macro.
§Performance
All work is done on demand, in one pass through the input iterators. Minimal memory is used.
§Example
Find the integers that appear in any of the SortedDisjoint iterators.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]).into_ranges();
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]).into_ranges();
let c = RangeSetBlaze::from_iter([25..=100]).into_ranges();
let union = [a, b, c].union();
assert_eq!(union.into_string(), "1..=15, 18..=100");Sourcefn intersection(self) -> NotIter<T, UnionKMerge<T, NotIter<T, I>>> ⓘ
fn intersection(self) -> NotIter<T, UnionKMerge<T, NotIter<T, I>>> ⓘ
Intersects the given SortedDisjoint iterators, creating a new SortedDisjoint iterator.
The input iterators must be of the same type. Any number of input iterators can be given.
For input iterators of different types, use the intersection_map_dyn! macro.
For exactly two inputs, you can also use the & operator.
When given zero inputs, it returns the universal set.
§Performance
All work is done on demand, in one pass through the input iterators. Minimal memory is used.
§Example
Find the integers that appear in all the SortedDisjoint iterators.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]).into_ranges();
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]).into_ranges();
let c = RangeSetBlaze::from_iter([-100..=100]).into_ranges();
let intersection = [a, b, c].intersection();
assert_eq!(intersection.into_string(), "5..=6, 8..=9, 11..=13");Sourcefn symmetric_difference(self) -> SymDiffKMerge<T, I>
fn symmetric_difference(self) -> SymDiffKMerge<T, I>
Computes the symmetric difference of the given SortedDisjoint iterators, creating a new SortedDisjoint iterator.
The symmetric difference is the set of elements that appear in an odd number of the input iterators.
The input iterators must be of the same type. Any number of input iterators can be given.
For input iterators of different types, use the symmetric_difference_map_dyn! macro.
§Performance
All work is done on demand, in one pass through the input iterators. Minimal memory is used.
§Example
Find the integers that appear in an odd number of the SortedDisjoint iterators.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]).into_ranges();
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]).into_ranges();
let c = RangeSetBlaze::from_iter([-100..=100]).into_ranges();
let symmetric_difference = [a, b, c].symmetric_difference();
assert_eq!(
symmetric_difference.into_string(),
"-100..=0, 5..=6, 8..=9, 11..=13, 16..=17, 30..=100"
);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.