Cldr.Unit.Conversion.convert-exclamation-mark

You're seeing just the function convert-exclamation-mark, go back to Cldr.Unit.Conversion module for more information.

Specs

Convert one unit into another unit of the same unit type (length, volume, mass, ...) and raises on a unit type mismatch

Arguments

Returns

  • a Unit.t of the unit type to_unit or

  • raises an exception

Examples

iex> Cldr.Unit.Conversion.convert!(Cldr.Unit.new!(:celsius, 0), :fahrenheit)
...> |> Cldr.Unit.round
#Cldr.Unit<:fahrenheit, 32.0>

iex> Cldr.Unit.Conversion.convert!(Cldr.Unit.new!(:fahrenheit, 32), :celsius)
...> |> Cldr.Unit.round
#Cldr.Unit<:celsius, 0.0>

Cldr.Unit.Conversion.convert Cldr.Unit.new!(:mile, 1), :gallon
** (Cldr.Unit.IncompatibleUnitsError) Operations can only be performed between units of the same type. Received :mile and :gallon