pub trait MultiwaySortedDisjoint<T: Integer, I>: IntoIterator<Item = I> + Sized
where I: SortedDisjoint<T>,
{ // Provided methods fn union(self) -> BitOrKMerge<T, I> { ... } fn intersection(self) -> BitAndKMerge<T, I> { ... } }
Expand description

The trait used to define methods on multiple SortedDisjoint iterators, specifically union and intersection.

Provided Methods§

source

fn union(self) -> BitOrKMerge<T, I>

Unions the given SortedDisjoint iterators, creating a new SortedDisjoint iterator. The input iterators must be of the same type. Any number of input iterators can be given.

For input iterators of different types, use the union_dyn macro.

Performance

All work is done on demand, in one pass through the input iterators. Minimal memory is used.

Example

Find the integers that appear in any of the SortedDisjoint iterators.

use range_set_blaze::prelude::*;

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

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

assert_eq!(union.to_string(), "1..=15, 18..=100");
source

fn intersection(self) -> BitAndKMerge<T, I>

Intersects the given SortedDisjoint iterators, creating a new SortedDisjoint iterator. The input iterators must be of the same type. Any number of input iterators can be given.

For input iterators of different types, use the intersection_dyn macro.

Performance

All work is done on demand, in one pass through the input iterators. Minimal memory is used.

Example

Find the integers that appear in all the SortedDisjoint iterators.

use range_set_blaze::prelude::*;

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

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

assert_eq!(intersection.to_string(), "5..=6, 8..=9, 11..=13");

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, II, I> MultiwaySortedDisjoint<T, I> for II
where T: Integer, I: SortedDisjoint<T>, II: IntoIterator<Item = I>,