pub enum DoubleConstraint {
Always,
Never,
Min {
n: f64,
},
Max {
n: f64,
},
Range {
min: f64,
max: f64,
},
And {
children: Vec<Self>,
},
Or {
children: Vec<Self>,
},
Not {
child: Box<Self>,
},
}Expand description
Double-precision float constraint.
No InSet or Multiple — those are ill-defined on floats (equality
is brittle, modulo is non-sensical).
Variants§
Always
Always satisfied.
Never
Never satisfied.
Min
value >= n.
Max
value <= n.
Range
min <= value <= max.
And
All children must hold.
Or
At least one child must hold.
Not
Child must not hold.
Implementations§
Source§impl DoubleConstraint
impl DoubleConstraint
Sourcepub fn canonicalize(self) -> Self
pub fn canonicalize(self) -> Self
Same rule set as IntConstraint::canonicalize.
Sourcepub fn canonical_bytes(&self) -> Vec<u8> ⓘ
pub fn canonical_bytes(&self) -> Vec<u8> ⓘ
Canonical byte form of this constraint as written.
Sourcepub fn fingerprint(&self) -> Fingerprint
pub fn fingerprint(&self) -> Fingerprint
Canonical fingerprint — auto-canonicalises first. NaN leaves
are folded to the canonical quiet-NaN pattern before hashing.
Trait Implementations§
Source§impl Clone for DoubleConstraint
impl Clone for DoubleConstraint
Source§fn clone(&self) -> DoubleConstraint
fn clone(&self) -> DoubleConstraint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DoubleConstraint
impl Debug for DoubleConstraint
Source§impl<'de> Deserialize<'de> for DoubleConstraint
impl<'de> Deserialize<'de> for DoubleConstraint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Not for DoubleConstraint
impl Not for DoubleConstraint
Source§impl PartialEq for DoubleConstraint
impl PartialEq for DoubleConstraint
Source§impl Serialize for DoubleConstraint
impl Serialize for DoubleConstraint
impl StructuralPartialEq for DoubleConstraint
Auto Trait Implementations§
impl Freeze for DoubleConstraint
impl RefUnwindSafe for DoubleConstraint
impl Send for DoubleConstraint
impl Sync for DoubleConstraint
impl Unpin for DoubleConstraint
impl UnsafeUnpin for DoubleConstraint
impl UnwindSafe for DoubleConstraint
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