Enum p8n_types::Constraint
source · pub enum Constraint {
Empty {
bits: usize,
},
Unsigned {
from: u64,
to: u64,
bits: usize,
},
Signed {
from: i64,
to: i64,
bits: usize,
},
Full {
bits: usize,
},
}Expand description
A range of n-bit integers.
Variants
Empty
Fields
bits: usizeBitsize of the integer this range constraints.
The empty range containing no values.
Unsigned
Fields
from: u64Lower bound (inclusive).
to: u64Upper bound (inclusive).
bits: usizeBitsize of the integer this range constraints.
A range from-to, both inclusive.
Signed
Fields
from: i64Lower bound (inclusive).
to: i64Upper bound (inclusive).
bits: usizeBitsize of the integer this range constraints.
A range from-to, both inclusive.
Full
Fields
bits: usizeBitsize of the integer this range constraints.
A range containing all bits long integer.
Implementations
sourceimpl Constraint
impl Constraint
sourcepub fn new(bits: usize) -> Result<Constraint>
pub fn new(bits: usize) -> Result<Constraint>
Creates a new full ranges, bits large.
sourcepub fn clamp_lower_bound_unsigned(&mut self, bound: u64)
pub fn clamp_lower_bound_unsigned(&mut self, bound: u64)
Sets the lower bound to the unsigned value bound (inclusive).
sourcepub fn clamp_lower_bound_signed(&mut self, bound: u64)
pub fn clamp_lower_bound_signed(&mut self, bound: u64)
Sets the lower bound to the signed value bound (inclusive).
sourcepub fn clamp_upper_bound_unsigned(&mut self, bound: u64)
pub fn clamp_upper_bound_unsigned(&mut self, bound: u64)
Sets the upper bound to the unsigned value bound (inclusive).
sourcepub fn clamp_upper_bound_signed(&mut self, bound: u64)
pub fn clamp_upper_bound_signed(&mut self, bound: u64)
Sets the upper bound to the signed value bound (inclusive).
sourcepub fn union_with(&mut self, other: Self)
pub fn union_with(&mut self, other: Self)
Extends the range to include all values in other.
sourcepub fn intersect_with(&mut self, other: Self)
pub fn intersect_with(&mut self, other: Self)
Limits this range to the values in other.
sourcepub fn limit(&self, v: Value) -> Value
pub fn limit(&self, v: Value) -> Value
Apply this range to v, returning either v itself of Undefined if it is outside.
Trait Implementations
sourceimpl Arbitrary for Constraint
impl Arbitrary for Constraint
sourceimpl Clone for Constraint
impl Clone for Constraint
sourcefn clone(&self) -> Constraint
fn clone(&self) -> Constraint
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceimpl Debug for Constraint
impl Debug for Constraint
sourceimpl PartialEq<Constraint> for Constraint
impl PartialEq<Constraint> for Constraint
sourcefn eq(&self, other: &Constraint) -> bool
fn eq(&self, other: &Constraint) -> bool
impl Eq for Constraint
impl StructuralEq for Constraint
impl StructuralPartialEq for Constraint
Auto Trait Implementations
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnwindSafe for Constraint
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.