v0.1.0
Initial release.
%AshWeight{mg: integer}struct.Ash.Typebehaviour: storage as integer milligrams.- Constructors:
new/2,from_mg/1,from_g/1,from_kg/1. Accept integer, float,Decimal, or numeric string.Decimal-based arithmetic prevents float drift. - Conversions:
to_mg/1(integer),to_g/1andto_kg/1(Decimal). - Arithmetic:
add/2,subtract/2,multiply/2. - Comparison:
compare/2,equal?/2. - Input casting:
%AshWeight{}, integer,{value, unit}tuple, atom- or string-keyed map,nil. - Constraints:
:min,:max(in mg). String.Charsformats"250 mg","1.5 g","2.25 kg"by picking the largest unit that yields|value| >= 1.