Crate value_unit
source ·Expand description
Using this crate I also created a handy cli calculator that can process units and store variables
See https://github.com/FBastiaan04/unit_calc/
Macros
- Allways use this macro to create a ValueUnit
Use in the following way:
Structs
- Allways use the ValueUnit macro to create this struct.
This struct implements all basic arithmatic methods and a power method.
It should be noted however that add, subtract, addassign and subassign will panic if the units are not identical.
Use try_add and try_sub if you want a Result.
root will also panic if not all units have a power which is a multiple of the power.