Expand description
This module contains the DynQuantity struct and code for:
- Interaction with a
DynQuantity: Basic arithmetic operation, conversion from and into other types, formatting, etc. - Parsing of strings into
DynQuantitys: Seefrom_str_implonly available if thefrom_strfeature is enabled). - Serialization and deserialization: See
serde_impl(only available if theserdefeature is enabled). - Conversion from and into
uom::si::Quantity: Seeuom_impl(only available if theuomfeature is enabled).
See the documentation string of DynQuantity for more information.
Modules§
- from_
str_ impl - Overview
- serde_
impl - This module is only available if the
serdefeature is enabled. It provides various functions which can be used to (fallible) deserialize a validDynQuantityrepresentation into any typeTwhich implementsTryFrom<DynQuantity>. See the docstring ofDynQuantityfor an overview over all possible representations. - uom_
impl - This module offers a
TryFromimplementation to convert from aDynQuantityto the statically-typedQuantitystruct from theuomcrate. This is a fallible operation, since the unit of measurement ofDynQuantityis only known at runtime, while the unit of measurement ofQuantityis defined at compile time via the type system.
Structs§
- DynQuantity
- This type represents a physical quantity via its numerical
valueand a unit of measurement (fieldexponents). The unit of measurement is not defined via the type system, but rather via the values of theUnit. This means that the unit of measurement is not fixed at compile time, but can change dynamically at runtime.
Traits§
- F64Real
OrComplex - This is an internal trait which is used to convert between
f64andComplex<f64>-basedDynQuantitystructs. It needs to be public because it is part of the type signature ofDynQuantity, but it is not meant to be implemented by external types and is therefore sealed.
Functions§
- to_vec
- Converts a slice of
DynQuantityto a vector of their valuesV. In constrast toto_vec_checked, this function does not check whether the units of the individualDynQuantityelements are identical. - to_
vec_ checked - Checks if all units of the
DynQuantityelements are identical. If that is the case, it converts the slice to a vector of their valuesV.