-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rjf/279 simplify unit configurations and conversions #281
base: main
Are you sure you want to change the base?
Rjf/279 simplify unit configurations and conversions #281
Conversation
i kept running into confusion as to whether an energy rate unit should follow the well-known convention of distance/energy unit, or if we should impose energy/distance unit, since that is more efficient for routing. but now i'm thinking, we should support both, and call me crazy, but i've started making that change: pub enum EnergyRateUnit {
DistancePerEnergy(DistanceUnit, EnergyUnit),
EnergyPerDistance(EnergyUnit, DistanceUnit),
} internally we can convert things to |
@nreinicke ok, now ready for review. also added another issue for volume in energy units which would further clean things up (see #293, maybe a good first issue?) |
This PR begins the work described in this milestone by introducing a
Convert
trait for units. changes in this PR are due to that change and the discovery + design task for the scope of this milestone.along the way:
Convert
methods take aCow<U>
for the given unit type. this allows us to avoid unnecessary copying when the conversion is between two of the same unit type (such as kwh -> kwh)Closes #279.