pub trait Sample: Clone + PartialOrd {
// Required methods
fn quantify(&self) -> f64;
fn qualify(val: f64) -> Self;
}Expand description
Helper-Trait for the kinds of value accepted for RandomVariables.
Required Methods§
Sourcefn quantify(&self) -> f64
fn quantify(&self) -> f64
Converts the value into a floating point number, potentially stripping units of measurements.
The units of measurement may be recovered (albeit with a potential loss in precision) through the use of qualify.
Sourcefn qualify(val: f64) -> Self
fn qualify(val: f64) -> Self
Converts a floating point number back into the sample type.
This method is allowed to produce values with reduced precision since its results are not used cumulatively. This method is used to recover units of measurement that were stripped earlier during the conversation via quantify.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<D, U, V> Sample for Quantity<D, U, V>where
D: Dimension + ?Sized,
U: Units<V> + ?Sized,
V: Conversion<V> + Num + AsPrimitive<f64> + FromPrimitive + PartialEq + PartialOrd,
Available on crate feature uom only.
impl<D, U, V> Sample for Quantity<D, U, V>where
D: Dimension + ?Sized,
U: Units<V> + ?Sized,
V: Conversion<V> + Num + AsPrimitive<f64> + FromPrimitive + PartialEq + PartialOrd,
Available on crate feature
uom only.