pub trait MultiwayRangeSetBlaze<'a, T: Integer + 'a>: IntoIterator<Item = &'a RangeSetBlaze<T>> + Sized {
// Provided methods
fn union(self) -> RangeSetBlaze<T> { ... }
fn intersection(self) -> RangeSetBlaze<T> { ... }
}Expand description
The trait used to provide methods on multiple RangeSetBlaze’s,
specifically union and intersection.
Also see MultiwayRangeSetBlazeRef.
Provided Methods§
sourcefn union(self) -> RangeSetBlaze<T>
fn union(self) -> RangeSetBlaze<T>
Unions the given RangeSetBlaze’s, creating a new RangeSetBlaze.
Any number of input can be given.
For exactly two inputs, you can also use the ‘|’ operator.
Also see MultiwayRangeSetBlazeRef::union.
Performance
All work is done on demand, in one pass through the inputs. Minimal memory is used.
Example
Find the integers that appear in any of the RangeSetBlaze’s.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]);
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]);
let c = RangeSetBlaze::from_iter([25..=100]);
let union = [a, b, c].union();
assert_eq!(union, RangeSetBlaze::from_iter([1..=15, 18..=100]));sourcefn intersection(self) -> RangeSetBlaze<T>
fn intersection(self) -> RangeSetBlaze<T>
Intersects the given RangeSetBlaze’s, creating a new RangeSetBlaze.
Any number of input can be given.
For exactly two inputs, you can also use the ‘&’ operator.
Also see MultiwayRangeSetBlazeRef::intersection.
Performance
All work is done on demand, in one pass through the inputs. Minimal memory is used.
Example
Find the integers that appear in all the RangeSetBlaze’s.
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=6, 8..=9, 11..=15]);
let b = RangeSetBlaze::from_iter([5..=13, 18..=29]);
let c = RangeSetBlaze::from_iter([-100..=100]);
let intersection = [a, b, c].intersection();
assert_eq!(intersection, RangeSetBlaze::from_iter([5..=6, 8..=9, 11..=13]));