pub struct Tolerance {
pub relative: Option<f64>,
pub absolute: Option<f64>,
}Expand description
How far a measured value may be from its reference: a fraction of it, an absolute difference, or whichever of the two is larger.
Fields§
§relative: Option<f64>A fraction of the reference value, as 0.03 for 3%.
absolute: Option<f64>An absolute difference, in the metric’s own unit.
Implementations§
Source§impl Tolerance
impl Tolerance
Sourcepub fn is_set(self) -> bool
pub fn is_set(self) -> bool
Whether this bounds anything at all. A bound that is not a positive, finite number gates nothing, the “ungated metric” of Loft lesson L79, so it does not count as set.
Sourcepub fn allowed(self, reference: f64) -> f64
pub fn allowed(self, reference: f64) -> f64
How much reference may move under this tolerance, in the metric’s own unit.
Sourcepub fn accepts(self, measured: f64, reference: f64) -> bool
pub fn accepts(self, measured: f64, reference: f64) -> bool
Whether measured is within this tolerance of reference: inside either bound that is
given. A tolerance with neither accepts nothing, so an unset one fails rather than passing
silently, and a value that is not a real number never passes.
Trait Implementations§
impl Copy for Tolerance
Source§impl<'de> Deserialize<'de> for Tolerance
impl<'de> Deserialize<'de> for Tolerance
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
impl StructuralPartialEq for Tolerance
Auto Trait Implementations§
impl Freeze for Tolerance
impl RefUnwindSafe for Tolerance
impl Send for Tolerance
impl Sync for Tolerance
impl Unpin for Tolerance
impl UnsafeUnpin for Tolerance
impl UnwindSafe for Tolerance
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