pub struct RangeSet<const K: usize = 2> { /* private fields */ }Expand description
A bounded union of at most K disjoint, inclusive unsigned intervals.
Operations first compute their exact interval pieces and, when there are
too many, fill the smallest gaps until the result fits. Thus K is a
compile-time precision/storage knob.
References:
- GCC’s bounded multi-range (
irange) design: https://gcc.gnu.org/pipermail/gcc/2020-September/233620.html - Bagnara, Hill, and Zaffanella, “Widening Operators for Powerset Domains”: https://www.cs.unipr.it/~zaffanella/Papers/Abstracts/Q349
Implementations§
Source§impl<const K: usize> RangeSet<K>
impl<const K: usize> RangeSet<K>
pub const fn empty() -> Self
pub fn full() -> Self
pub fn from_value(value: u64) -> Self
pub fn from_range(low: u64, high: u64) -> Self
pub fn ranges(&self) -> &[(u64, u64)]
pub fn is_empty(&self) -> bool
pub fn contains_value(&self, value: u64) -> bool
pub fn union(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
Sourcepub fn cardinality(&self) -> u128
pub fn cardinality(&self) -> u128
The number of represented values. 2^64 is representable in u128.
Trait Implementations§
impl<const K: usize> Copy for RangeSet<K>
impl<const K: usize> Eq for RangeSet<K>
impl<const K: usize> StructuralPartialEq for RangeSet<K>
Auto Trait Implementations§
impl<const K: usize> Freeze for RangeSet<K>
impl<const K: usize> RefUnwindSafe for RangeSet<K>
impl<const K: usize> Send for RangeSet<K>
impl<const K: usize> Sync for RangeSet<K>
impl<const K: usize> Unpin for RangeSet<K>
impl<const K: usize> UnsafeUnpin for RangeSet<K>
impl<const K: usize> UnwindSafe for RangeSet<K>
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
Mutably borrows from an owned value. Read more