pub trait MultiwayRangeSetBlazeRef<T: Integer>: IntoIterator<Item = 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 references, specifically union and intersection.

Also see MultiwayRangeSetBlaze.

Provided Methods§

source

fn union(self) -> RangeSetBlaze<T>

Unions 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 MultiwayRangeSetBlaze::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 = vec![a, b, c].into_iter().union();

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

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 MultiwayRangeSetBlaze::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 = vec![a, b, c].into_iter().intersection();

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

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, I> MultiwayRangeSetBlazeRef<T> for I
where T: Integer, I: IntoIterator<Item = RangeSetBlaze<T>>,