[][src]Enum p8n_types::Constraint

pub enum Constraint {
    Empty {
        bits: usize,
    },
    Unsigned {
        from: u64,
        to: u64,
        bits: usize,
    },
    Signed {
        from: i64,
        to: i64,
        bits: usize,
    },
    Full {
        bits: usize,
    },
}

A range of n-bit integers.

Variants

Empty

The empty range containing no values.

Fields of Empty

bits: usize

Bitsize of the integer this range constraints.

Unsigned

A range from-to, both inclusive.

Fields of Unsigned

from: u64

Lower bound (inclusive).

to: u64

Upper bound (inclusive).

bits: usize

Bitsize of the integer this range constraints.

Signed

A range from-to, both inclusive.

Fields of Signed

from: i64

Lower bound (inclusive).

to: i64

Upper bound (inclusive).

bits: usize

Bitsize of the integer this range constraints.

Full

A range containing all bits long integer.

Fields of Full

bits: usize

Bitsize of the integer this range constraints.

Methods

impl Constraint[src]

pub fn new(bits: usize) -> Result<Constraint>[src]

Creates a new full ranges, bits large.

pub fn is_empty(&self) -> bool[src]

Returns true if the range includes no values.

pub fn clamp_lower_bound_unsigned(&mut self, bound: u64)[src]

Sets the lower bound to the unsigned value bound (inclusive).

pub fn clamp_lower_bound_signed(&mut self, bound: u64)[src]

Sets the lower bound to the signed value bound (inclusive).

pub fn clamp_upper_bound_unsigned(&mut self, bound: u64)[src]

Sets the upper bound to the unsigned value bound (inclusive).

pub fn clamp_upper_bound_signed(&mut self, bound: u64)[src]

Sets the upper bound to the signed value bound (inclusive).

pub fn union_with(&mut self, other: Self)[src]

Extends the range to include all values in other.

pub fn intersect_with(&mut self, other: Self)[src]

Limits this range to the values in other.

pub fn include(&mut self, bound: u64)[src]

Limits the range to bound.

pub fn exclude(&mut self, bound: u64)[src]

Move the range to exclude bound.

pub fn bits(&self) -> usize[src]

Size of the range bounds in bits.

pub fn limit(&self, v: Value) -> Value[src]

Apply this range to v, returning either v itself of Undefined if it is outside.

pub fn signed(value: u64, bits: usize) -> i64[src]

Helper to convert value to a bits large signed integer.

pub fn invert(&mut self)[src]

Inverts the ranges to include all values it excluded before.

pub fn inverted(&self) -> Self[src]

Returns the inverted range. See invert.

Trait Implementations

impl Eq for Constraint[src]

impl Clone for Constraint[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Constraint> for Constraint[src]

impl Debug for Constraint[src]

impl Arbitrary for Constraint[src]

fn shrink(&self) -> Box<dyn Iterator<Item = Self> + 'static>[src]

Auto Trait Implementations

impl Send for Constraint

impl Sync for Constraint

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]