Skip to main content

Module length

Module length 

Source
Expand description

Hash-able floating-point wrappers, percentage values, and CSS size metric types used by the CSS property system.

Structs§

FloatValue
Wrapper around an f32 value that is internally casted to an isize, in order to provide hash-ability (to avoid numerical instability).
PercentageValue
Wrapper around FloatValue, represents a percentage instead of just being a regular floating-point value, i.e 5 = 5%

Enums§

OptionPercentageValue
PercentageParseError
PercentageParseErrorOwned
SizeMetric
Enum representing the metric associated with a number (px, pt, em, etc.)

Constants§

FP_PRECISION_MULTIPLIER
Multiplier for floating point accuracy. Elements such as px or % are only accurate until a certain number of decimal points, therefore they have to be casted to isizes in order to make the f32 values hash-able: Css has a relatively low precision here, roughly 3 digits, i.e 1.001 == 1.0

Functions§

parse_float_value
parse_percentage_value
Parse “1.2” or “120%” (similar to parse_pixel_value)