Open robfitzgerald opened 2 months ago
@nreinicke This issue seems to be relevant: https://github.com/JelteF/derive_more/issues/168
Adding #[mul(forward)]
to InternalFloat
creates an impl for e.g. InternalFloat::ZERO * InternalFloat::ONE;
, but does not generate an impl for InternalFloat::ZERO * 1.0
; removing that attribute does the opposite.
Until that issue is resolved, it seems like we either keep it as is, or, as the compiler suggests, add .into()
calls wherever we have internal floats multiplied by primitive floats (gross):
error[E0308]: mismatched types
--> routee-compass-core/src/model/unit/weight_unit.rs:24:44
|
24 | (S::Kg, S::Pounds) => *value * 2.20462,
| ^^^^^^^ expected `InternalFloat`, found floating-point number
|
help: call `Into::into` on this expression to convert `{float}` into `unit::internal_float::InternalFloat`
|
24 | (S::Kg, S::Pounds) => *value * 2.20462.into(),
| +++++++
Leaving this here for now, but it should still be possible to get the contained primitive float out of one of the objects and use that, i.e. by sequential .0
accesses
While deriving
derive_more
numeric traits for Cost (or other types that wrap OrderedFloat) compiles, when we attempt to use the methods, we get a failure: