pub fn format_length(
value: f64,
unit: &ConversionUnit,
format: &LengthFormat,
) -> Result<String, UnitConversionError>Expand description
Write value, a length in unit, as format asks.
Negative lengths keep their sign in front (-1' - 6"). A fraction is
reduced (4/8 is written 1/2), and inches that round up to twelve
carry into the feet. This is IfcOpenShell’s format_length layout
(util/unit.py), with the value given in any length unit rather than
in feet or inches.
§Errors
UnitConversionError::DimensionMismatch when unit, or the decimal
format’s unit, is not a length; UnitConversionError::NonFinite for a
value that is not finite; UnitConversionError::InvalidFormat for a
zero denominator or a value too large to round to it.