pub struct Rnum { /* private fields */ }Expand description
Range number.
This independent signed/unsigned-bounds representation follows the scalar range information maintained alongside tracked numbers by the Linux eBPF verifier: https://docs.kernel.org/bpf/verifier.html#register-value-tracking
Implementations§
Source§impl Rnum
impl Rnum
Sourcepub const fn new(min: u64, max: u64, smin: i64, smax: i64) -> Option<Self>
pub const fn new(min: u64, max: u64, smin: i64, smax: i64) -> Option<Self>
Construct independent unsigned and signed inclusive ranges.
pub const fn from_value(value: u64) -> Self
pub const fn unsigned_bounds(&self) -> (u64, u64)
pub const fn signed_bounds(&self) -> (i64, i64)
Sourcepub const fn value(&self) -> Option<u64>
pub const fn value(&self) -> Option<u64>
Return the sole contained value, if this domain is constant.
Sourcepub const fn is_defined(&self) -> bool
pub const fn is_defined(&self) -> bool
Whether the domain contains at least one machine value.
Sourcepub const fn contains_value(&self, value: u64) -> bool
pub const fn contains_value(&self, value: u64) -> bool
Whether this domain includes value in both interpretations.
Sourcepub const fn union(&self, other: Self) -> Self
pub const fn union(&self, other: Self) -> Self
Return the least range containing both operands.
Sourcepub const fn intersection(&self, other: Self) -> Self
pub const fn intersection(&self, other: Self) -> Self
Return the values represented by both operands.
Sourcepub const fn contains(&self, other: Self) -> bool
pub const fn contains(&self, other: Self) -> bool
Whether this abstract range includes all bounds represented by other.
pub const fn has_value(&self) -> bool
pub const fn min_value(&self) -> Option<u64>
pub const fn max_value(&self) -> Option<u64>
pub const fn add(self, other: Self) -> Self
pub const fn subtract(self, other: Self) -> Self
pub const fn negate(self) -> Self
pub const fn bit_not(self) -> Self
pub const fn multiply(self, other: Self) -> Self
pub const fn checked_div(self, other: Self) -> Option<Self>
pub const fn divide(self, other: Self) -> Self
pub const fn remainder(self, other: Self) -> Self
Trait Implementations§
impl Copy for Rnum
impl Eq for Rnum
impl StructuralPartialEq for Rnum
Auto Trait Implementations§
impl Freeze for Rnum
impl RefUnwindSafe for Rnum
impl Send for Rnum
impl Sync for Rnum
impl Unpin for Rnum
impl UnsafeUnpin for Rnum
impl UnwindSafe for Rnum
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