Expand description
This module is only available if the serde feature is enabled.
It provides various functions which can be used to (fallible)
deserialize a valid DynQuantity representation into any type T which
implements TryFrom<DynQuantity>. See the docstring of DynQuantity for an
overview over all possible representations.
Constants§
- SERIALIZE_
WITH_ UNITS - A thread-local, static variable which enables / disables serialization of
quantities with or without units. It is used within the functions
serialize_quantity,serialize_opt_quantity,serialize_angleandserialize_opt_angleas a thread-local context to decide whether a quantity should be serialized with or without its units. By default, its value isfalse, meaning that quantities are serialized without their units. Theserialize_with_unitsfunction sets it temporarily totrue, then performs the actual serialization, and afterwards resets it tofalseagain (return to default behaviour).
Functions§
- deserialize_
angle - Deserializes an angle from a valid
DynQuantityrepresentation (see docstring ofDynQuantity). The output value is always in radians. - deserialize_
opt_ angle - Like
deserialize_angle, but deserializes into anOption<f64>instead of af64. - deserialize_
opt_ quantity - Like
deserialize_quantity, but deserializes into anOption<T>instead of aTimplementingTryFrom<DynQuantity>. - deserialize_
opt_ vec_ of_ quantities - Like
deserialize_vec_of_quantities, but deserializes into anOption<Vec<T>>instead of aVec<T>. - deserialize_
quantity - Deserializes a type
TimplementingTryFrom<DynQuantity>from a validDynQuantityrepresentation (see docstring ofDynQuantity). - deserialize_
vec_ of_ quantities - Deserializes a vector of
Twhich implementsTryFrom<DynQuantity>from: - serialize_
angle - Enables serialization of an angle into a string containing both the value and the “rad” unit.
- serialize_
opt_ angle - Like
serialize_angle, but serializes an&Option<T>instead of a&TimplementingInto<DynQuantity>. - serialize_
opt_ quantity - Like
serialize_quantity, but serializes an&Option<T>instead of a&TimplementingInto<DynQuantity>. - serialize_
quantity - Enables serialization of a quantity (any type implementing
Into<DynQuantity>) into a string containing both the value and the units. - serialize_
with_ units - A wrapper around a serialization function / closure which enables serialization with units.