pub struct BitRange<const K: usize = 2> { /* private fields */ }Expand description
Reduced product of a bounded interval union and known/unknown bits.
Its concrete values satisfy both components. Reduction exchanges cheap unsigned-bound and common-bit facts after construction and operations.
This follows the reduced-product pattern used by the Linux eBPF verifier,
which maintains signed bounds, unsigned bounds, and a tnum together:
https://docs.kernel.org/bpf/verifier.html#register-value-tracking
LLVM implements the analogous conversions between ConstantRange and
KnownBits:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/IR/ConstantRange.cpp
Implementations§
Source§impl<const K: usize> BitRange<K>
impl<const K: usize> BitRange<K>
pub fn new(ranges: RangeSet<K>, bits: Tnum) -> Self
pub fn from_value(value: u64) -> Self
pub fn from_ranges(ranges: RangeSet<K>) -> Self
pub fn from_bits(bits: Tnum) -> Self
pub fn ranges(&self) -> RangeSet<K>
pub fn bits(&self) -> Tnum
pub fn contains_value(&self, value: u64) -> bool
pub fn is_empty(&self) -> bool
pub fn union(self, other: Self) -> Self
pub fn intersection(self, other: Self) -> Self
Trait Implementations§
impl<const K: usize> Copy for BitRange<K>
impl<const K: usize> Eq for BitRange<K>
impl<const K: usize> StructuralPartialEq for BitRange<K>
Auto Trait Implementations§
impl<const K: usize> Freeze for BitRange<K>
impl<const K: usize> RefUnwindSafe for BitRange<K>where
RangeSet<K>: RefUnwindSafe,
impl<const K: usize> Send for BitRange<K>
impl<const K: usize> Sync for BitRange<K>
impl<const K: usize> Unpin for BitRange<K>
impl<const K: usize> UnsafeUnpin for BitRange<K>where
RangeSet<K>: UnsafeUnpin,
impl<const K: usize> UnwindSafe for BitRange<K>where
RangeSet<K>: 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
Mutably borrows from an owned value. Read more