Struct range_set_blaze::RangeSetBlaze
source · pub struct RangeSetBlaze<T: Integer> { /* private fields */ }Expand description
A set of integers stored as sorted & disjoint ranges.
Internally, it stores the ranges in a cache-efficient BTreeMap.
Table of Contents
RangeSetBlazeConstructorsRangeSetBlazeSet OperationsRangeSetBlazeComparisons- Additional Examples
RangeSetBlaze Constructors
You can also create RangeSetBlaze’s from unsorted and overlapping integers (or ranges).
However, if you know that your input is sorted and disjoint, you can speed up construction.
Here are the constructors, followed by a description of the performance, and then some examples.
| Methods | Input |
|---|---|
new/default | |
from_iter/collect | integer iterator |
from_iter/collect | ranges iterator |
from_sorted_disjoint /into_range_set_blaze | SortedDisjoint iterator |
from /into | array of integers |
Constructor Performance
The from_iter/collect constructors are designed to work fast on ‘clumpy’ data.
By ‘clumpy’, we mean that the number of ranges needed to represent the data is
small compared to the number of input integers. To understand this, consider the internals
of the constructors:
Internally, the constructors take these steps:
- collect adjacent integers/ranges into disjoint ranges, O(n₁)
- sort the disjoint ranges by their
start, O(n₂ log n₂) - merge adjacent ranges, O(n₂)
- create a
BTreeMapfrom the now sorted & disjoint ranges, O(n₃ log n₃)
where n₁ is the number of input integers/ranges, n₂ is the number of disjoint & unsorted ranges, and n₃ is the final number of sorted & disjoint ranges.
For example, an input of
3, 2, 1, 4, 5, 6, 7, 0, 8, 8, 8, 100, 1, becomes0..=8, 100..=100, 1..=1, and then0..=8, 1..=1, 100..=100, and finally0..=8, 100..=100.
What is the effect of clumpy data? Notice that if n₂ ≈ sqrt(n₁), then construction is O(n₁). (Indeed, as long as n₂ ≤ n₁/ln(n₁), then construction is O(n₁).) Moreover, we’ll see that set operations are O(n₃). Thus, if n₃ ≈ sqrt(n₁) then set operations are O(sqrt(n₁)), a quadratic improvement an O(n₁) implementation that ignores the clumps.
Constructor Examples
use range_set_blaze::prelude::*;
// Create an empty set with 'new' or 'default'.
let a0 = RangeSetBlaze::<i32>::new();
let a1 = RangeSetBlaze::<i32>::default();
assert!(a0 == a1 && a0.is_empty());
// 'from_iter'/'collect': From an iterator of integers.
// Duplicates and out-of-order elements are fine.
let a0 = RangeSetBlaze::from_iter([3, 2, 1, 100, 1]);
let a1: RangeSetBlaze<i32> = [3, 2, 1, 100, 1].into_iter().collect();
assert!(a0 == a1 && a0.to_string() == "1..=3, 100..=100");
// 'from_iter'/'collect': From an iterator of inclusive ranges, start..=end.
// Overlapping, out-of-order, and empty ranges are fine.
#[allow(clippy::reversed_empty_ranges)]
let a0 = RangeSetBlaze::from_iter([1..=2, 2..=2, -10..=-5, 1..=0]);
#[allow(clippy::reversed_empty_ranges)]
let a1: RangeSetBlaze<i32> = [1..=2, 2..=2, -10..=-5, 1..=0].into_iter().collect();
assert!(a0 == a1 && a0.to_string() == "-10..=-5, 1..=2");
// If we know the ranges are already sorted and disjoint,
// we can avoid work and use 'from'/'into'.
let a0 = RangeSetBlaze::from_sorted_disjoint(CheckSortedDisjoint::from([-10..=-5, 1..=2]));
let a1: RangeSetBlaze<i32> = CheckSortedDisjoint::from([-10..=-5, 1..=2]).into_range_set_blaze();
assert!(a0 == a1 && a0.to_string() == "-10..=-5, 1..=2");
// For compatibility with `BTreeSet`, we also support
// 'from'/'into' from arrays of integers.
let a0 = RangeSetBlaze::from([3, 2, 1, 100, 1]);
let a1: RangeSetBlaze<i32> = [3, 2, 1, 100, 1].into();
assert!(a0 == a1 && a0.to_string() == "1..=3, 100..=100");RangeSetBlaze Set Operations
You can perform set operations on RangeSetBlazes using operators.
| Set Operation | Operator | Multiway Method |
|---|---|---|
| union | a | b | [a, b, c].union() |
| intersection | a & b | [a, b, c].intersection() |
| difference | a - b | n/a |
| symmetric difference | a ^ b | n/a |
| complement | !a | n/a |
RangeSetBlaze also implements many other methods, such as insert, pop_first and split_off. Many of
these methods match those of BTreeSet.
Set Operation Performance
Every operation is implemented as
- a single pass over the sorted & disjoint ranges
- the construction of a new
RangeSetBlaze
Thus, applying multiple operators creates intermediate
RangeSetBlaze’s. If you wish, you can avoid these intermediate
RangeSetBlaze’s by switching to the SortedDisjoint API. The last example below
demonstrates this.
Set Operation Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
// Union of two 'RangeSetBlaze's.
let result = &a | &b;
// Alternatively, we can take ownership via 'a | b'.
assert_eq!(result.to_string(), "1..=100");
// Intersection of two 'RangeSetBlaze's.
let result = &a & &b; // Alternatively, 'a & b'.
assert_eq!(result.to_string(), "2..=2, 5..=6");
// Set difference of two 'RangeSetBlaze's.
let result = &a - &b; // Alternatively, 'a - b'.
assert_eq!(result.to_string(), "1..=1, 7..=100");
// Symmetric difference of two 'RangeSetBlaze's.
let result = &a ^ &b; // Alternatively, 'a ^ b'.
assert_eq!(result.to_string(), "1..=1, 3..=4, 7..=100");
// complement of a 'RangeSetBlaze'.
let result = !&a; // Alternatively, '!a'.
assert_eq!(
result.to_string(),
"-2147483648..=0, 3..=4, 101..=2147483647"
);
// Multiway union of 'RangeSetBlaze's.
let c = RangeSetBlaze::from_iter([2..=2, 6..=200]);
let result = [&a, &b, &c].union();
assert_eq!(result.to_string(), "1..=200");
// Multiway intersection of 'RangeSetBlaze's.
let result = [&a, &b, &c].intersection();
assert_eq!(result.to_string(), "2..=2, 6..=6");
// Applying multiple operators
let result0 = &a - (&b | &c); // Creates an intermediate 'RangeSetBlaze'.
// Alternatively, we can use the 'SortedDisjoint' API and avoid the intermediate 'RangeSetBlaze'.
let result1 = RangeSetBlaze::from_sorted_disjoint(a.ranges() - (b.ranges() | c.ranges()));
assert!(result0 == result1 && result0.to_string() == "1..=1");RangeSetBlaze Comparisons
We can compare RangeSetBlazes using the following operators:
<, <=, >, >=. Following the convention of BTreeSet,
these comparisons are lexicographic. See cmp for more examples.
Use the is_subset and is_superset methods to check if one RangeSetBlaze is a subset
or superset of another.
Use ==, != to check if two RangeSetBlazes are equal or not.
Additional Examples
See the module-level documentation for additional examples.
Implementations§
source§impl<T: Integer> RangeSetBlaze<T>
impl<T: Integer> RangeSetBlaze<T>
sourcepub fn iter(&self) -> Iter<T, RangesIter<'_, T>> ⓘ
pub fn iter(&self) -> Iter<T, RangesIter<'_, T>> ⓘ
Gets an iterator that visits the integer elements in the RangeSetBlaze in ascending
order.
Also see the RangeSetBlaze::ranges method.
Examples
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([1..=3]);
let mut set_iter = set.iter();
assert_eq!(set_iter.next(), Some(1));
assert_eq!(set_iter.next(), Some(2));
assert_eq!(set_iter.next(), Some(3));
assert_eq!(set_iter.next(), None);Values returned by the iterator are returned in ascending order:
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([3, 1, 2]);
let mut set_iter = set.iter();
assert_eq!(set_iter.next(), Some(1));
assert_eq!(set_iter.next(), Some(2));
assert_eq!(set_iter.next(), Some(3));
assert_eq!(set_iter.next(), None);sourcepub fn first(&self) -> Option<T>
pub fn first(&self) -> Option<T>
Returns the first element in the set, if any. This element is always the minimum of all integer elements in the set.
Examples
Basic usage:
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
assert_eq!(set.first(), None);
set.insert(1);
assert_eq!(set.first(), Some(1));
set.insert(2);
assert_eq!(set.first(), Some(1));sourcepub fn get(&self, value: T) -> Option<T>
pub fn get(&self, value: T) -> Option<T>
Returns the element in the set, if any, that is equal to the value.
Examples
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([1, 2, 3]);
assert_eq!(set.get(2), Some(2));
assert_eq!(set.get(4), None);sourcepub fn last(&self) -> Option<T>
pub fn last(&self) -> Option<T>
Returns the last element in the set, if any. This element is always the maximum of all elements in the set.
Examples
Basic usage:
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
assert_eq!(set.last(), None);
set.insert(1);
assert_eq!(set.last(), Some(1));
set.insert(2);
assert_eq!(set.last(), Some(2));sourcepub fn from_sorted_disjoint<I>(iter: I) -> Selfwhere
I: SortedDisjoint<T>,
pub fn from_sorted_disjoint<I>(iter: I) -> Selfwhere I: SortedDisjoint<T>,
Create a RangeSetBlaze from a SortedDisjoint iterator.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::prelude::*;
let a0 = RangeSetBlaze::from_sorted_disjoint(CheckSortedDisjoint::from([-10..=-5, 1..=2]));
let a1: RangeSetBlaze<i32> = CheckSortedDisjoint::from([-10..=-5, 1..=2]).into_range_set_blaze();
assert!(a0 == a1 && a0.to_string() == "-10..=-5, 1..=2");sourcepub fn append(&mut self, other: &mut Self)
pub fn append(&mut self, other: &mut Self)
Moves all elements from other into self, leaving other empty.
Performance
It adds the integers in other to self in O(n log m) time, where n is the number of ranges in other
and m is the number of ranges in self.
When n is large, consider using | which is O(n+m) time.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=3]);
let mut b = RangeSetBlaze::from_iter([3..=5]);
a.append(&mut b);
assert_eq!(a.len(), 5usize);
assert_eq!(b.len(), 0usize);
assert!(a.contains(1));
assert!(a.contains(2));
assert!(a.contains(3));
assert!(a.contains(4));
assert!(a.contains(5));
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the set, removing all integer elements.
Examples
use range_set_blaze::RangeSetBlaze;
let mut v = RangeSetBlaze::new();
v.insert(1);
v.clear();
assert!(v.is_empty());sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the set contains no elements.
Examples
use range_set_blaze::RangeSetBlaze;
let mut v = RangeSetBlaze::new();
assert!(v.is_empty());
v.insert(1);
assert!(!v.is_empty());sourcepub fn is_subset(&self, other: &RangeSetBlaze<T>) -> bool
pub fn is_subset(&self, other: &RangeSetBlaze<T>) -> bool
Returns true if the set is a subset of another,
i.e., other contains at least all the elements in self.
Examples
use range_set_blaze::RangeSetBlaze;
let sup = RangeSetBlaze::from_iter([1..=3]);
let mut set = RangeSetBlaze::new();
assert_eq!(set.is_subset(&sup), true);
set.insert(2);
assert_eq!(set.is_subset(&sup), true);
set.insert(4);
assert_eq!(set.is_subset(&sup), false);sourcepub fn is_superset(&self, other: &RangeSetBlaze<T>) -> bool
pub fn is_superset(&self, other: &RangeSetBlaze<T>) -> bool
Returns true if the set is a superset of another,
i.e., self contains at least all the elements in other.
Examples
use range_set_blaze::RangeSetBlaze;
let sub = RangeSetBlaze::from_iter([1, 2]);
let mut set = RangeSetBlaze::new();
assert_eq!(set.is_superset(&sub), false);
set.insert(0);
set.insert(1);
assert_eq!(set.is_superset(&sub), false);
set.insert(2);
assert_eq!(set.is_superset(&sub), true);sourcepub fn contains(&self, value: T) -> bool
pub fn contains(&self, value: T) -> bool
Returns true if the set contains an element equal to the value.
Examples
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([1, 2, 3]);
assert_eq!(set.contains(1), true);
assert_eq!(set.contains(4), false);sourcepub fn is_disjoint(&self, other: &RangeSetBlaze<T>) -> bool
pub fn is_disjoint(&self, other: &RangeSetBlaze<T>) -> bool
Returns true if self has no elements in common with other.
This is equivalent to checking for an empty intersection.
Examples
use range_set_blaze::RangeSetBlaze;
let a = RangeSetBlaze::from_iter([1..=3]);
let mut b = RangeSetBlaze::new();
assert_eq!(a.is_disjoint(&b), true);
b.insert(4);
assert_eq!(a.is_disjoint(&b), true);
b.insert(1);
assert_eq!(a.is_disjoint(&b), false);sourcepub fn insert(&mut self, value: T) -> bool
pub fn insert(&mut self, value: T) -> bool
Adds a value to the set.
Returns whether the value was newly inserted. That is:
- If the set did not previously contain an equal value,
trueis returned. - If the set already contained an equal value,
falseis returned, and the entry is not updated.
Performance
Inserting n items will take in O(n log m) time, where n is the number of inserted items and m is the number of ranges in self.
When n is large, consider using | which is O(n+m) time.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
assert_eq!(set.insert(2), true);
assert_eq!(set.insert(2), false);
assert_eq!(set.len(), 1usize);sourcepub fn range<R>(&self, range: R) -> IntoIter<T> ⓘwhere
R: RangeBounds<T>,
pub fn range<R>(&self, range: R) -> IntoIter<T> ⓘwhere R: RangeBounds<T>,
Constructs an iterator over a sub-range of elements in the set.
Not to be confused with RangeSetBlaze::ranges, which returns an iterator over the ranges in the set.
The simplest way is to use the range syntax min..max, thus range(min..max) will
yield elements from min (inclusive) to max (exclusive).
The range may also be entered as (Bound<T>, Bound<T>), so for example
range((Excluded(4), Included(10))) will yield a left-exclusive, right-inclusive
range from 4 to 10.
Panics
Panics if range start > end.
Panics if range start == end and both bounds are Excluded.
Performance
Although this could be written to run in time O(ln(n)) in the number of ranges, it is currently O(n) in the number of ranges.
Examples
use range_set_blaze::RangeSetBlaze;
use core::ops::Bound::Included;
let mut set = RangeSetBlaze::new();
set.insert(3);
set.insert(5);
set.insert(8);
for elem in set.range((Included(4), Included(8))) {
println!("{elem}");
}
assert_eq!(Some(5), set.range(4..).next());sourcepub fn ranges_insert(&mut self, range: RangeInclusive<T>) -> bool
pub fn ranges_insert(&mut self, range: RangeInclusive<T>) -> bool
Adds a range to the set.
Returns whether any values where newly inserted. That is:
- If the set did not previously contain some value in the range,
trueis returned. - If the set already contained every value in the range,
falseis returned, and the entry is not updated.
Performance
Inserting n items will take in O(n log m) time, where n is the number of inserted items and m is the number of ranges in self.
When n is large, consider using | which is O(n+m) time.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
assert_eq!(set.ranges_insert(2..=5), true);
assert_eq!(set.ranges_insert(5..=6), true);
assert_eq!(set.ranges_insert(3..=4), false);
assert_eq!(set.len(), 5usize);sourcepub fn remove(&mut self, value: T) -> bool
pub fn remove(&mut self, value: T) -> bool
If the set contains an element equal to the value, removes it from the set and drops it. Returns whether such an element was present.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
set.insert(2);
assert!(set.remove(2));
assert!(!set.remove(2));sourcepub fn split_off(&mut self, value: T) -> Self
pub fn split_off(&mut self, value: T) -> Self
Splits the collection into two at the value. Returns a new collection with all elements greater than or equal to the value.
Examples
Basic usage:
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::new();
a.insert(1);
a.insert(2);
a.insert(3);
a.insert(17);
a.insert(41);
let b = a.split_off(3);
assert_eq!(a, RangeSetBlaze::from_iter([1, 2]));
assert_eq!(b, RangeSetBlaze::from_iter([3, 17, 41]));sourcepub fn take(&mut self, value: T) -> Option<T>
pub fn take(&mut self, value: T) -> Option<T>
Removes and returns the element in the set, if any, that is equal to the value.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::from_iter([1, 2, 3]);
assert_eq!(set.take(2), Some(2));
assert_eq!(set.take(2), None);sourcepub fn replace(&mut self, value: T) -> Option<T>
pub fn replace(&mut self, value: T) -> Option<T>
Adds a value to the set, replacing the existing element, if any, that is equal to the value. Returns the replaced element.
Note: This is very similar to insert. It is included for consistency with BTreeSet.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
assert!(set.replace(5).is_none());
assert!(set.replace(5).is_some());sourcepub const fn len(&self) -> <T as Integer>::SafeLen
pub const fn len(&self) -> <T as Integer>::SafeLen
Returns the number of elements in the set.
The number is allowed to be very, very large.
Examples
use range_set_blaze::RangeSetBlaze;
let mut v = RangeSetBlaze::new();
assert_eq!(v.len(), 0usize);
v.insert(1);
assert_eq!(v.len(), 1usize);
let v = RangeSetBlaze::from_iter([
-170_141_183_460_469_231_731_687_303_715_884_105_728i128..=10,
-10..=170_141_183_460_469_231_731_687_303_715_884_105_726,
]);
assert_eq!(
v.len(),
340_282_366_920_938_463_463_374_607_431_768_211_455u128
);sourcepub fn new() -> Self
pub fn new() -> Self
Makes a new, empty RangeSetBlaze.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set: RangeSetBlaze<i32> = RangeSetBlaze::new();sourcepub fn pop_first(&mut self) -> Option<T>
pub fn pop_first(&mut self) -> Option<T>
Removes the first element from the set and returns it, if any. The first element is always the minimum element in the set.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
set.insert(1);
while let Some(n) = set.pop_first() {
assert_eq!(n, 1);
}
assert!(set.is_empty());sourcepub fn pop_last(&mut self) -> Option<T>
pub fn pop_last(&mut self) -> Option<T>
Removes the last value from the set and returns it, if any. The last value is always the maximum value in the set.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::new();
set.insert(1);
while let Some(n) = set.pop_last() {
assert_eq!(n, 1);
}
assert!(set.is_empty());sourcepub fn ranges(&self) -> RangesIter<'_, T> ⓘ
pub fn ranges(&self) -> RangesIter<'_, T> ⓘ
An iterator that visits the ranges in the RangeSetBlaze,
i.e., the integers as sorted & disjoint ranges.
Also see RangeSetBlaze::iter and RangeSetBlaze::into_ranges.
Examples
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([10..=20, 15..=25, 30..=40]);
let mut ranges = set.ranges();
assert_eq!(ranges.next(), Some(10..=25));
assert_eq!(ranges.next(), Some(30..=40));
assert_eq!(ranges.next(), None);Values returned by the iterator are returned in ascending order:
use range_set_blaze::RangeSetBlaze;
let set = RangeSetBlaze::from_iter([30..=40, 15..=25, 10..=20]);
let mut ranges = set.ranges();
assert_eq!(ranges.next(), Some(10..=25));
assert_eq!(ranges.next(), Some(30..=40));
assert_eq!(ranges.next(), None);sourcepub fn into_ranges(self) -> IntoRangesIter<T> ⓘ
pub fn into_ranges(self) -> IntoRangesIter<T> ⓘ
An iterator that moves out the ranges in the RangeSetBlaze,
i.e., the integers as sorted & disjoint ranges.
Also see RangeSetBlaze::into_iter and RangeSetBlaze::ranges.
Examples
use range_set_blaze::RangeSetBlaze;
let mut ranges = RangeSetBlaze::from_iter([10..=20, 15..=25, 30..=40]).into_ranges();
assert_eq!(ranges.next(), Some(10..=25));
assert_eq!(ranges.next(), Some(30..=40));
assert_eq!(ranges.next(), None);Values returned by the iterator are returned in ascending order:
use range_set_blaze::RangeSetBlaze;
let mut ranges = RangeSetBlaze::from_iter([30..=40, 15..=25, 10..=20]).into_ranges();
assert_eq!(ranges.next(), Some(10..=25));
assert_eq!(ranges.next(), Some(30..=40));
assert_eq!(ranges.next(), None);sourcepub fn ranges_len(&self) -> usize
pub fn ranges_len(&self) -> usize
Returns the number of sorted & disjoint ranges in the set.
Example
use range_set_blaze::RangeSetBlaze;
// We put in three ranges, but they are not sorted & disjoint.
let set = RangeSetBlaze::from_iter([10..=20, 15..=25, 30..=40]);
// After RangeSetBlaze sorts & 'disjoint's them, we see two ranges.
assert_eq!(set.ranges_len(), 2);
assert_eq!(set.to_string(), "10..=25, 30..=40");sourcepub fn retain<F>(&mut self, f: F)where
F: FnMut(&T) -> bool,
pub fn retain<F>(&mut self, f: F)where F: FnMut(&T) -> bool,
Retains only the elements specified by the predicate.
In other words, remove all integers e for which f(&e) returns false.
The integer elements are visited in ascending order.
Examples
use range_set_blaze::RangeSetBlaze;
let mut set = RangeSetBlaze::from_iter([1..=6]);
// Keep only the even numbers.
set.retain(|k| k % 2 == 0);
assert_eq!(set, RangeSetBlaze::from_iter([2, 4, 6]));Trait Implementations§
source§impl<T> BitAnd<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> BitAnd<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn bitand(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitand(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Intersects the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a & &b; // Alternatively, 'a & b'.
assert_eq!(result.to_string(), "2..=2, 5..=6");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
& operator.source§impl<T> BitAnd<&RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> BitAnd<&RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn bitand(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitand(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Intersects the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a & &b; // Alternatively, 'a & b'.
assert_eq!(result.to_string(), "2..=2, 5..=6");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
& operator.source§impl<T> BitAnd<RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> BitAnd<RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn bitand(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitand(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Intersects the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a & &b; // Alternatively, 'a & b'.
assert_eq!(result.to_string(), "2..=2, 5..=6");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
& operator.source§impl<T> BitAnd<RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> BitAnd<RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn bitand(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitand(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Intersects the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a & &b; // Alternatively, 'a & b'.
assert_eq!(result.to_string(), "2..=2, 5..=6");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
& operator.source§impl<T: Integer> BitOr<&RangeSetBlaze<T>> for &RangeSetBlaze<T>
impl<T: Integer> BitOr<&RangeSetBlaze<T>> for &RangeSetBlaze<T>
source§fn bitor(self, other: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitor(self, other: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Unions the contents of two RangeSetBlaze’s.
Passing ownership rather than borrow sometimes allows a many-times faster speed up.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([0..=0,3..=5,10..=10]);
let union = &a | &b;
assert_eq!(union, RangeSetBlaze::from_iter([0..=5, 10..=10]));§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
| operator.source§impl<T: Integer> BitOr<&RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: Integer> BitOr<&RangeSetBlaze<T>> for RangeSetBlaze<T>
§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
Unions the contents of two RangeSetBlaze’s.
Passing ownership rather than borrow sometimes allows a many-times faster speed up.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([0..=0,3..=5,10..=10]);
let union = a | &b;
assert_eq!(union, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§impl<T: Integer> BitOr<RangeSetBlaze<T>> for &RangeSetBlaze<T>
impl<T: Integer> BitOr<RangeSetBlaze<T>> for &RangeSetBlaze<T>
source§fn bitor(self, other: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitor(self, other: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Unions the contents of two RangeSetBlaze’s.
Passing ownership rather than borrow sometimes allows a many-times faster speed up.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([0..=0,3..=5,10..=10]);
let union = &a | b;
assert_eq!(union, RangeSetBlaze::from_iter([0..=5, 10..=10]));§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
| operator.source§impl<T: Integer> BitOr<RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: Integer> BitOr<RangeSetBlaze<T>> for RangeSetBlaze<T>
§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
Unions the contents of two RangeSetBlaze’s.
Passing ownership rather than borrow sometimes allows a many-times faster speed up.
Examples
use range_set_blaze::RangeSetBlaze;
let a = RangeSetBlaze::from_iter([1..=4]);
let b = RangeSetBlaze::from_iter([0..=0, 3..=5, 10..=10]);
let union = a | b;
assert_eq!(union, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§fn bitor(self, other: Self) -> RangeSetBlaze<T>
fn bitor(self, other: Self) -> RangeSetBlaze<T>
| operation. Read moresource§impl<T: Integer> BitOrAssign<&RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: Integer> BitOrAssign<&RangeSetBlaze<T>> for RangeSetBlaze<T>
source§fn bitor_assign(&mut self, other: &Self)
fn bitor_assign(&mut self, other: &Self)
Adds the contents of another RangeSetBlaze to this one.
Passing the right-hand side by ownership rather than borrow will allow a many-times faster speed up when the right-hand side is much larger than the left-hand side.
Also, this operation is never slower than RangeSetBlaze::extend and
can often be many times faster.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([0..=0,3..=5,10..=10]);
a |= &b;
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§impl<T: Integer> BitOrAssign<RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: Integer> BitOrAssign<RangeSetBlaze<T>> for RangeSetBlaze<T>
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
Adds the contents of another RangeSetBlaze to this one.
Passing the right-hand side by ownership rather than borrow will allow a many-times faster speed up when the right-hand side is much larger than the left-hand side.
Also, this operation is never slower than RangeSetBlaze::extend and
can often be many times faster.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([0..=0,3..=5,10..=10]);
a |= b;
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§impl<T> BitXor<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> BitXor<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn bitxor(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitxor(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Symmetric difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a ^ &b; // Alternatively, 'a ^ b'.
assert_eq!(result.to_string(), "1..=1, 3..=4, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
^ operator.source§impl<T> BitXor<&RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> BitXor<&RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn bitxor(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitxor(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Symmetric difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a ^ &b; // Alternatively, 'a ^ b'.
assert_eq!(result.to_string(), "1..=1, 3..=4, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
^ operator.source§impl<T> BitXor<RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> BitXor<RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn bitxor(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitxor(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Symmetric difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a ^ &b; // Alternatively, 'a ^ b'.
assert_eq!(result.to_string(), "1..=1, 3..=4, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
^ operator.source§impl<T> BitXor<RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> BitXor<RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn bitxor(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn bitxor(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Symmetric difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a ^ &b; // Alternatively, 'a ^ b'.
assert_eq!(result.to_string(), "1..=1, 3..=4, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
^ operator.source§impl<T: Clone + Integer> Clone for RangeSetBlaze<T>
impl<T: Clone + Integer> Clone for RangeSetBlaze<T>
source§fn clone(&self) -> RangeSetBlaze<T>
fn clone(&self) -> RangeSetBlaze<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T: Integer> Debug for RangeSetBlaze<T>
impl<T: Integer> Debug for RangeSetBlaze<T>
source§impl<T: Default + Integer> Default for RangeSetBlaze<T>
impl<T: Default + Integer> Default for RangeSetBlaze<T>
source§fn default() -> RangeSetBlaze<T>
fn default() -> RangeSetBlaze<T>
source§impl<T: Integer> Display for RangeSetBlaze<T>
impl<T: Integer> Display for RangeSetBlaze<T>
source§impl<T: Integer> Extend<RangeInclusive<T>> for RangeSetBlaze<T>
impl<T: Integer> Extend<RangeInclusive<T>> for RangeSetBlaze<T>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = RangeInclusive<T>>,
fn extend<I>(&mut self, iter: I)where I: IntoIterator<Item = RangeInclusive<T>>,
Extends the RangeSetBlaze with the contents of a
range iterator.
Elements are added one-by-one. There is also a version
that takes an integer iterator.
The |= operator extends a RangeSetBlaze
from another RangeSetBlaze. It is never slower
than RangeSetBlaze::extend and often several times faster.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
a.extend([5..=5, 0..=0, 0..=0, 3..=4, 10..=10]);
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([5..=5, 0..=0, 0..=0, 3..=4, 10..=10]);
a |= b;
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl<T: Integer> Extend<T> for RangeSetBlaze<T>
impl<T: Integer> Extend<T> for RangeSetBlaze<T>
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where I: IntoIterator<Item = T>,
Extends the RangeSetBlaze with the contents of an Integer iterator.
Integers are added one-by-one. There is also a version that takes a range iterator.
The |= operator extends a RangeSetBlaze
from another RangeSetBlaze. It is never slower
than RangeSetBlaze::extend and often several times faster.
Examples
use range_set_blaze::RangeSetBlaze;
let mut a = RangeSetBlaze::from_iter([1..=4]);
a.extend([5, 0, 0, 3, 4, 10]);
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));
let mut a = RangeSetBlaze::from_iter([1..=4]);
let mut b = RangeSetBlaze::from_iter([5, 0, 0, 3, 4, 10]);
a |= b;
assert_eq!(a, RangeSetBlaze::from_iter([0..=5, 10..=10]));source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)source§impl<T: Integer, const N: usize> From<[T; N]> for RangeSetBlaze<T>
impl<T: Integer, const N: usize> From<[T; N]> for RangeSetBlaze<T>
source§fn from(arr: [T; N]) -> Self
fn from(arr: [T; N]) -> Self
For compatibility with BTreeSet you may create a RangeSetBlaze from an array of integers.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::RangeSetBlaze;
let a0 = RangeSetBlaze::from([3, 2, 1, 100, 1]);
let a1: RangeSetBlaze<i32> = [3, 2, 1, 100, 1].into();
assert!(a0 == a1 && a0.to_string() == "1..=3, 100..=100")source§impl<'a, T: Integer + 'a> FromIterator<&'a RangeInclusive<T>> for RangeSetBlaze<T>
impl<'a, T: Integer + 'a> FromIterator<&'a RangeInclusive<T>> for RangeSetBlaze<T>
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a RangeInclusive<T>>,
fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = &'a RangeInclusive<T>>,
Create a RangeSetBlaze from an iterator of inclusive ranges, start..=end.
Overlapping, out-of-order, and empty ranges are fine.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::RangeSetBlaze;
#[allow(clippy::reversed_empty_ranges)]
let vec_range = vec![1..=2, 2..=2, -10..=-5, 1..=0];
let a0 = RangeSetBlaze::from_iter(vec_range.iter());
let a1: RangeSetBlaze<i32> = vec_range.iter().collect();
assert!(a0 == a1 && a0.to_string() == "-10..=-5, 1..=2");source§impl<'a, T: Integer> FromIterator<&'a T> for RangeSetBlaze<T>
impl<'a, T: Integer> FromIterator<&'a T> for RangeSetBlaze<T>
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = &'a T>,
fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = &'a T>,
Create a RangeSetBlaze from an iterator of integers references. Duplicates and out-of-order elements are fine.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::RangeSetBlaze;
let a0 = RangeSetBlaze::from_iter(vec![3, 2, 1, 100, 1]);
let a1: RangeSetBlaze<i32> = vec![3, 2, 1, 100, 1].into_iter().collect();
assert!(a0 == a1 && a0.to_string() == "1..=3, 100..=100");source§impl<T: Integer> FromIterator<RangeInclusive<T>> for RangeSetBlaze<T>
impl<T: Integer> FromIterator<RangeInclusive<T>> for RangeSetBlaze<T>
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = RangeInclusive<T>>,
fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = RangeInclusive<T>>,
Create a RangeSetBlaze from an iterator of inclusive ranges, start..=end.
Overlapping, out-of-order, and empty ranges are fine.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::RangeSetBlaze;
#[allow(clippy::reversed_empty_ranges)]
let a0 = RangeSetBlaze::from_iter([1..=2, 2..=2, -10..=-5, 1..=0]);
#[allow(clippy::reversed_empty_ranges)]
let a1: RangeSetBlaze<i32> = [1..=2, 2..=2, -10..=-5, 1..=0].into_iter().collect();
assert!(a0 == a1 && a0.to_string() == "-10..=-5, 1..=2");source§impl<T: Integer> FromIterator<T> for RangeSetBlaze<T>
impl<T: Integer> FromIterator<T> for RangeSetBlaze<T>
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Selfwhere I: IntoIterator<Item = T>,
Create a RangeSetBlaze from an iterator of integers. Duplicates and out-of-order elements are fine.
For more about constructors and performance, see RangeSetBlaze Constructors.
Examples
use range_set_blaze::RangeSetBlaze;
let a0 = RangeSetBlaze::from_iter([3, 2, 1, 100, 1]);
let a1: RangeSetBlaze<i32> = [3, 2, 1, 100, 1].into_iter().collect();
assert!(a0 == a1 && a0.to_string() == "1..=3, 100..=100");source§impl<T: Integer> IntoIterator for RangeSetBlaze<T>
impl<T: Integer> IntoIterator for RangeSetBlaze<T>
source§impl<T> Not for &RangeSetBlaze<T>where
T: Integer,
impl<T> Not for &RangeSetBlaze<T>where T: Integer,
source§fn not(self) -> RangeSetBlaze<T>
fn not(self) -> RangeSetBlaze<T>
Complement the contents of a RangeSetBlaze.
The input may be borrowed or not.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let result = !&a; // Alternatively, '!a'.
assert_eq!(
result.to_string(),
"-2147483648..=0, 3..=4, 101..=2147483647"
);§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
! operator.source§impl<T> Not for RangeSetBlaze<T>where
T: Integer,
impl<T> Not for RangeSetBlaze<T>where T: Integer,
source§fn not(self) -> RangeSetBlaze<T>
fn not(self) -> RangeSetBlaze<T>
Complement the contents of a RangeSetBlaze.
The input may be borrowed or not.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let result = !&a; // Alternatively, '!a'.
assert_eq!(
result.to_string(),
"-2147483648..=0, 3..=4, 101..=2147483647"
);§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
! operator.source§impl<T: Integer> Ord for RangeSetBlaze<T>
impl<T: Integer> Ord for RangeSetBlaze<T>
source§fn cmp(&self, other: &RangeSetBlaze<T>) -> Ordering
fn cmp(&self, other: &RangeSetBlaze<T>) -> Ordering
We define a total ordering on RangeSetBlaze. Following the convention of
BTreeSet, the ordering is lexicographic, not by subset/superset.
Examples
use range_set_blaze::RangeSetBlaze;
let a = RangeSetBlaze::from_iter([1..=3, 5..=7]);
let b = RangeSetBlaze::from_iter([2..=2]);
assert!(a < b); // Lexicographic comparison
assert!(b.is_subset(&a)); // Subset comparison
// More lexicographic comparisons
assert!(a <= b);
assert!(b > a);
assert!(b >= a);
assert!(a != b);
assert!(a == a);
use core::cmp::Ordering;
assert_eq!(a.cmp(&b), Ordering::Less);
assert_eq!(a.partial_cmp(&b), Some(Ordering::Less));1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<T: PartialEq + Integer> PartialEq<RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: PartialEq + Integer> PartialEq<RangeSetBlaze<T>> for RangeSetBlaze<T>
source§fn eq(&self, other: &RangeSetBlaze<T>) -> bool
fn eq(&self, other: &RangeSetBlaze<T>) -> bool
self and other values to be equal, and is used
by ==.source§impl<T: Integer> PartialOrd<RangeSetBlaze<T>> for RangeSetBlaze<T>
impl<T: Integer> PartialOrd<RangeSetBlaze<T>> for RangeSetBlaze<T>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl<T> Sub<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> Sub<&RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn sub(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn sub(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a - &b; // Alternatively, 'a - b'.
assert_eq!(result.to_string(), "1..=1, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
- operator.source§impl<T> Sub<&RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> Sub<&RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn sub(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn sub(self, rhs: &RangeSetBlaze<T>) -> RangeSetBlaze<T>
Difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a - &b; // Alternatively, 'a - b'.
assert_eq!(result.to_string(), "1..=1, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
- operator.source§impl<T> Sub<RangeSetBlaze<T>> for &RangeSetBlaze<T>where
T: Integer,
impl<T> Sub<RangeSetBlaze<T>> for &RangeSetBlaze<T>where T: Integer,
source§fn sub(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn sub(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a - &b; // Alternatively, 'a - b'.
assert_eq!(result.to_string(), "1..=1, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
- operator.source§impl<T> Sub<RangeSetBlaze<T>> for RangeSetBlaze<T>where
T: Integer,
impl<T> Sub<RangeSetBlaze<T>> for RangeSetBlaze<T>where T: Integer,
source§fn sub(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
fn sub(self, rhs: RangeSetBlaze<T>) -> RangeSetBlaze<T>
Difference the contents of two RangeSetBlaze’s.
Either, neither, or both inputs may be borrowed.
Examples
use range_set_blaze::prelude::*;
let a = RangeSetBlaze::from_iter([1..=2, 5..=100]);
let b = RangeSetBlaze::from_iter([2..=6]);
let result = &a - &b; // Alternatively, 'a - b'.
assert_eq!(result.to_string(), "1..=1, 7..=100");§type Output = RangeSetBlaze<T>
type Output = RangeSetBlaze<T>
- operator.impl<T: Integer> Eq for RangeSetBlaze<T>
impl<T: Integer> StructuralPartialEq for RangeSetBlaze<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for RangeSetBlaze<T>where T: RefUnwindSafe, <T as Integer>::SafeLen: RefUnwindSafe,
impl<T> Send for RangeSetBlaze<T>
impl<T> Sync for RangeSetBlaze<T>where <T as Integer>::SafeLen: Sync,
impl<T> Unpin for RangeSetBlaze<T>where <T as Integer>::SafeLen: Unpin,
impl<T> UnwindSafe for RangeSetBlaze<T>where T: RefUnwindSafe, <T as Integer>::SafeLen: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<'a, T, I> MultiwayRangeSetBlaze<'a, T> for Iwhere
T: Integer + 'a,
I: IntoIterator<Item = &'a RangeSetBlaze<T>>,
impl<'a, T, I> MultiwayRangeSetBlaze<'a, T> for Iwhere T: Integer + 'a, I: IntoIterator<Item = &'a RangeSetBlaze<T>>,
source§fn union(self) -> RangeSetBlaze<T>
fn union(self) -> RangeSetBlaze<T>
RangeSetBlaze’s, creating a new RangeSetBlaze.
Any number of input can be given. Read moresource§fn intersection(self) -> RangeSetBlaze<T>
fn intersection(self) -> RangeSetBlaze<T>
RangeSetBlaze’s, creating a new RangeSetBlaze.
Any number of input can be given. Read moresource§impl<T, I> MultiwayRangeSetBlazeRef<T> for Iwhere
T: Integer,
I: IntoIterator<Item = RangeSetBlaze<T>>,
impl<T, I> MultiwayRangeSetBlazeRef<T> for Iwhere T: Integer, I: IntoIterator<Item = RangeSetBlaze<T>>,
source§fn union(self) -> RangeSetBlaze<T>
fn union(self) -> RangeSetBlaze<T>
RangeSetBlaze references, creating a new RangeSetBlaze.
Any number of input can be given. Read moresource§fn intersection(self) -> RangeSetBlaze<T>
fn intersection(self) -> RangeSetBlaze<T>
RangeSetBlaze references, creating a new RangeSetBlaze.
Any number of input can be given. Read moresource§impl<T, II, I> MultiwaySortedDisjoint<T, I> for IIwhere
T: Integer,
I: SortedDisjoint<T>,
II: IntoIterator<Item = I>,
impl<T, II, I> MultiwaySortedDisjoint<T, I> for IIwhere T: Integer, I: SortedDisjoint<T>, II: IntoIterator<Item = I>,
source§fn union(self) -> BitOrKMerge<T, I>
fn union(self) -> BitOrKMerge<T, I>
SortedDisjoint iterators, creating a new SortedDisjoint iterator.
The input iterators must be of the same type. Any number of input iterators can be given. Read moresource§fn intersection(self) -> BitAndKMerge<T, I>
fn intersection(self) -> BitAndKMerge<T, I>
SortedDisjoint iterators, creating a new SortedDisjoint iterator.
The input iterators must be of the same type. Any number of input iterators can be given. Read more