Open
Description
In the experimental/unitsconversion/src/provider.rs
file, there are a couple of potential improvements that could be made to enhance the code quality and maintainability.
- Consider using ZeroTrie: Currently, we are using ZeroMap to map from unit name to indices.
/// Maps from unit name (e.g. foot) to the index of the unit in the `unit_quantity` vector.
#[cfg_attr(feature = "serde", serde(borrow))]
pub units_info: ZeroMap<'data, str, UnitsInfoIndex>;
- Consider using
Option<Dimension>
andOption<ConversionInfo>
: Currently, we are using indices to reference the Dimension and ConversionInfo in their respective vectors. - Consider removing the dimension from the units conversion data. During the units conversion, not all the users wants to know the dimension. For example: acre's dimension is area