pub enum FuzzyTolerance {
Absolute(f64),
Percentage(f64),
}Expand description
Tolerance specification for fuzzy comparisons
Used with within syntax: a ~= b within 0.02 or a ~= b within 2%
Variants§
Absolute(f64)
Absolute tolerance: within 5 means |a - b| <= 5
Percentage(f64)
Percentage tolerance: within 2% means |a - b| / avg(|a|, |b|) <= 0.02
Implementations§
Trait Implementations§
Source§impl Clone for FuzzyTolerance
impl Clone for FuzzyTolerance
Source§fn clone(&self) -> FuzzyTolerance
fn clone(&self) -> FuzzyTolerance
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 FuzzyTolerance
impl Debug for FuzzyTolerance
Source§impl<'de> Deserialize<'de> for FuzzyTolerance
impl<'de> Deserialize<'de> for FuzzyTolerance
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 PartialEq for FuzzyTolerance
impl PartialEq for FuzzyTolerance
Source§impl Serialize for FuzzyTolerance
impl Serialize for FuzzyTolerance
impl StructuralPartialEq for FuzzyTolerance
Auto Trait Implementations§
impl Freeze for FuzzyTolerance
impl RefUnwindSafe for FuzzyTolerance
impl Send for FuzzyTolerance
impl Sync for FuzzyTolerance
impl Unpin for FuzzyTolerance
impl UnsafeUnpin for FuzzyTolerance
impl UnwindSafe for FuzzyTolerance
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