Function parse_decimal_number

Source
pub fn parse_decimal_number(
    s: &str,
    pref_const: u128,
) -> Result<u128, DecimalNumberParsingError>
Expand description

Parsing decimal numbers from &str type in u128. Function also takes a value of metric prefix in u128 type. parse_str use the u128 type, and have the same max and min values.

If the fractional part is longer than several zeros in the prefix, it will return the error DecimalNumberParsingError::LongFractional.

If the string slice has invalid chars, it will return the error DecimalNumberParsingError::InvalidNumber.

If the whole part of the number has a value more than the u64 maximum value, it will return the error DecimalNumberParsingError::LongWhole.