[−][src]Enum p8n_types::Constraint
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
Signed
A range from
-to
, both inclusive.
Fields of Signed
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(&self) -> 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]
fn eq(&self, other: &Constraint) -> bool
[src]
fn ne(&self, other: &Constraint) -> bool
[src]
impl Debug for Constraint
[src]
impl Arbitrary for Constraint
[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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,