precision_from_str

Function precision_from_str 

Source
pub fn precision_from_str(s: &str) -> u8
Expand description

Returns the decimal precision inferred from the given string.

For scientific notation with large negative exponents (e.g., “1e-300”, “1e-4294967296”), the precision is clamped to u8::MAX (255) since that represents the maximum representable precision in this system. This handles arbitrarily large exponents without panicking.

§Panics

Panics if the input string is malformed (e.g., “1e-” with no exponent value, or non-numeric exponents like “1e-abc”).