Skip to main content

ratio

Function ratio 

Source
pub fn ratio(input: &str) -> Result<Ratio, ParseError>
Expand description

A dimensionless fraction: 25%, 0.25, 1.

This parser accepts a bare number, unlike the other dimensions, because a fraction’s unit is “none”. A % suffix scales by a hundredth.

§Errors

ParseError if the magnitude is not a finite decimal number, or the unit is anything other than %.