pub trait MultiwayRangeMapBlazeRef<'a, T: Integer + 'a, V: Eq + Clone + 'a>: IntoIterator<Item = &'a RangeMapBlaze<T, V>> + Sized {
// Provided methods
fn union(self) -> RangeMapBlaze<T, V> { ... }
fn intersection(self) -> RangeMapBlaze<T, V> { ... }
fn symmetric_difference(self) -> RangeMapBlaze<T, V> { ... }
}Expand description
Provides methods on zero or more RangeMapBlaze references,
specifically union, intersection and symmetric_difference.
Also see MultiwayRangeMapBlaze.
Provided Methods§
Sourcefn union(self) -> RangeMapBlaze<T, V>
fn union(self) -> RangeMapBlaze<T, V>
Unions the given RangeMapBlaze references, creating a new RangeMapBlaze.
Any number of input can be given.
For exactly two inputs, you can also use the ‘|’ operator.
Also see MultiwayRangeMapBlaze::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 RangeMapBlaze references.
use range_set_blaze::prelude::*;
let a = RangeMapBlaze::from_iter([(1..=2, "a"), (5..=100, "a")]);
let b = RangeMapBlaze::from_iter([(2..=6, "b")]);
let c = RangeMapBlaze::from_iter([(2..=2, "c"), (6..=200, "c")]);
let union = [a, b, c].union();
assert_eq!(union.to_string(), r#"(1..=2, "a"), (3..=4, "b"), (5..=100, "a"), (101..=200, "c")"#);Sourcefn intersection(self) -> RangeMapBlaze<T, V>
fn intersection(self) -> RangeMapBlaze<T, V>
Intersects the given RangeMapBlaze references, creating a new RangeMapBlaze.
Any number of input can be given.
For exactly two inputs, you can also use the ‘&’ operator.
Also see MultiwayRangeMapBlaze::intersection.
§Panics
The intersection of zero maps causes a panic. Mathematically, it could be a mapping from all integers to some fill-in value but we don’t implement that.
§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 RangeMapBlaze references.
use range_set_blaze::prelude::*;
let a = RangeMapBlaze::from_iter([(1..=2, "a"), (5..=100, "a")]);
let b = RangeMapBlaze::from_iter([(2..=6, "b")]);
let c = RangeMapBlaze::from_iter([(2..=2, "c"), (6..=200, "c")]);
let intersection = [a, b, c].intersection();
assert_eq!(intersection.to_string(), r#"(2..=2, "a"), (6..=6, "a")"#);Sourcefn symmetric_difference(self) -> RangeMapBlaze<T, V>
fn symmetric_difference(self) -> RangeMapBlaze<T, V>
Symmetric difference on the given RangeMapBlaze references, creating a new RangeMapBlaze.
use range_set_blaze::prelude::*;
let a = RangeMapBlaze::from_iter([(1..=2, "a"), (5..=100, "a")]);
let b = RangeMapBlaze::from_iter([(2..=6, "b")]);
let c = RangeMapBlaze::from_iter([(2..=2, "c"), (6..=200, "c")]);
let symmetric_difference = [a, b, c].symmetric_difference();
assert_eq!(symmetric_difference.to_string(), r#"(1..=2, "a"), (3..=4, "b"), (6..=6, "a"), (101..=200, "c")"#);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.