pub trait MultiwayRangeSetBlaze<T: Integer>: IntoIterator<Item = RangeSetBlaze<T>> + Sized {
// Provided methods
fn union(self) -> RangeSetBlaze<T> { ... }
fn intersection(self) -> RangeSetBlaze<T> { ... }
fn symmetric_difference(self) -> RangeSetBlaze<T> { ... }
}Expand description
Provides methods on zero or more RangeSetBlaze’s,
specifically union, intersection and symmetric_difference.
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 references, 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.
When given zero inputs, it returns the universal set.
§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]));Sourcefn symmetric_difference(self) -> RangeSetBlaze<T>
fn symmetric_difference(self) -> RangeSetBlaze<T>
Computes the symmetric difference of the given RangeSetBlaze references,
creating a new RangeSetBlaze.
The symmetric difference is the set of elements that appear in an odd number
of the input sets.
Any number of inputs can be given.
For exactly two inputs, you can also use the ‘^’ operator.
Also see MultiwayRangeSetBlazeRef::symmetric_difference.
§Performance
All work is done on demand, in one pass through the inputs. Minimal memory is used.
§Example
Find the integers that appear in an odd number of the RangeSetBlazes.
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 symmetric_difference = [a, b, c].symmetric_difference();
assert_eq!(
symmetric_difference,
RangeSetBlaze::from_iter([
-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.