Trait range_set_blaze::MultiwayRangeMapBlaze

source ·
pub trait MultiwayRangeMapBlaze<'a, T: Integer + 'a, V: ValueOwned + '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

The trait used to provide methods on multiple RangeMapBlaze’s, specifically union and intersection.

Also see [MultiwayRangeMapBlazeRef].

Provided Methods§

source

fn union(self) -> RangeMapBlaze<T, V>

Unions the given RangeMapBlaze’s, creating a new RangeMapBlaze. Any number of input can be given.

For exactly two inputs, you can also use the ‘|’ operator. Also see [MultiwayRangeMapBlazeRef::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’s.

use range_set_blaze::prelude::*;

let a = RangeMapBlaze::from_iter([1..=6, 8..=9, 11..=15]);
let b = RangeMapBlaze::from_iter([5..=13, 18..=29]);
let c = RangeMapBlaze::from_iter([25..=100]);

let union = [a, b, c].union();

assert_eq!(union, RangeMapBlaze::from_iter([1..=15, 18..=100]));
source

fn intersection(self) -> RangeMapBlaze<T, V>

Intersects the given RangeMapBlaze’s, creating a new RangeMapBlaze. Any number of input can be given.

For exactly two inputs, you can also use the ‘&’ operator. Also see [MultiwayRangeMapBlazeRef::intersection].

The intersection of 0 maps is undefined. (We can create a universal set of integers, but we don’t know that value to use.)

§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’s.

use range_set_blaze::prelude::*;

let a = RangeMapBlaze::from_iter([1..=6, 8..=9, 11..=15]);
let b = RangeMapBlaze::from_iter([5..=13, 18..=29]);
let c = RangeMapBlaze::from_iter([-100..=100]);

let intersection = [a, b, c].intersection();

assert_eq!(intersection, RangeMapBlaze::from_iter([5..=6, 8..=9, 11..=13]));
source

fn symmetric_difference(self) -> RangeMapBlaze<T, V>

Symmetric difference on the given RangeMapBlaze’s, creating a new RangeMapBlaze.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T, V, I> MultiwayRangeMapBlaze<'a, T, V> for I
where T: Integer + 'a, V: ValueOwned + 'a, I: IntoIterator<Item = &'a RangeMapBlaze<T, V>>,