-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
I am currently working on a project where I need to parse quantities and their units from a text file, and write the quantities back into equivalent text files with the same units.
I do not have control over the units specified in the files, and was hoping to use the from_str methods to parse these strings, and then use the pull the unit off the Quantity struct and store it somewhere. (although it looks like this is not possible due to the usage of PhantomData<>)
This has turned into a nightmare of Generic parameters and I am also getting some strange errors when trying to use the into_format_args method that I can't figure out.
Any assistance or advice is appreciated.
into_format_args error:
format!("{}", format_args)
| -- ^^^^^^^^^^^ expected `Ratio<i64>`, found associated type
| |
| required by a bound introduced by this call
|
= note: expected struct `num_rational::Ratio<i64>`
found associated type `<T as uom::Conversion<num_rational::Ratio<i64>>>::T`
into_format_args call site:
// m is defined as a struct field of type rational64::Mass
// u is defined as a generic struct field T: Unit + Conversion<Rational64>
let format_args = m.into_format_args(u, DisplayStyle::Abbreviation);
format!("{}", format_args)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels