Skip to main content

Rnum

Struct Rnum 

Source
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

Source

pub const fn new(min: u64, max: u64, smin: i64, smax: i64) -> Option<Self>

Construct independent unsigned and signed inclusive ranges.

Source

pub const fn from_value(value: u64) -> Self

Source

pub const fn unsigned_bounds(&self) -> (u64, u64)

Source

pub const fn signed_bounds(&self) -> (i64, i64)

Source

pub const fn is_const(&self) -> bool

Whether the domain contains exactly one machine value.

Source

pub const fn value(&self) -> Option<u64>

Return the sole contained value, if this domain is constant.

Source

pub const fn is_defined(&self) -> bool

Whether the domain contains at least one machine value.

Source

pub const fn contains_value(&self, value: u64) -> bool

Whether this domain includes value in both interpretations.

Source

pub const fn union(&self, other: Self) -> Self

Return the least range containing both operands.

Source

pub const fn intersection(&self, other: Self) -> Self

Return the values represented by both operands.

Source

pub const fn contains(&self, other: Self) -> bool

Whether this abstract range includes all bounds represented by other.

Source

pub const fn has_value(&self) -> bool

Source

pub const fn min_value(&self) -> Option<u64>

Source

pub const fn max_value(&self) -> Option<u64>

Source

pub const fn add(self, other: Self) -> Self

Source

pub const fn subtract(self, other: Self) -> Self

Source

pub const fn negate(self) -> Self

Source

pub const fn bit_not(self) -> Self

Source

pub const fn multiply(self, other: Self) -> Self

Source

pub const fn checked_div(self, other: Self) -> Option<Self>

Source

pub const fn divide(self, other: Self) -> Self

Source

pub const fn remainder(self, other: Self) -> Self

Trait Implementations§

Source§

impl Add for Rnum

Source§

type Output = Rnum

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl Clone for Rnum

Source§

fn clone(&self) -> Rnum

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Rnum

Source§

impl Debug for Rnum

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Rnum

Source§

fn default() -> Self

Default is the range containing every 64-bit machine value.

Source§

impl Div for Rnum

Source§

type Output = Rnum

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
Source§

impl Eq for Rnum

Source§

impl Mul for Rnum

Source§

type Output = Rnum

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl Neg for Rnum

Source§

type Output = Rnum

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl Not for Rnum

Source§

type Output = Rnum

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl PartialEq for Rnum

Source§

fn eq(&self, other: &Rnum) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Rem for Rnum

Source§

type Output = Rnum

The resulting type after applying the % operator.
Source§

fn rem(self, other: Self) -> Self

Performs the % operation. Read more
Source§

impl StructuralPartialEq for Rnum

Source§

impl Sub for Rnum

Source§

type Output = Rnum

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.