fn parse_number(input: &str) -> Result<Value, Error> {
    if let Some("0x" | "0X") = input.get(..2) {
        let number = u64::from_str_radix(&input[2..], 16).map_err(|_| Error::IntegerOverflow(input.to_owned()))?;
        return Ok(number.into());
    }

    Ok(match input.parse::<u64>() {
        Ok(number) => number.into(),
        Err(_) => Value::from_finite_f64(input.parse::<f64>().unwrap()),
    })
}
/// Parses a number (integer or floating-point number) into a value.
Parses a number (integer or floating-point number) into a value.
Parses a number ( integer or floating - point number ) into a value .
fn parse_number(input: &str) -> Result<Value, Error> {
    if let Some("0x" | "0X") = input.get(..2) {
        let number = u64::from_str_radix(&input[2..], 16).map_err(|_| Error::IntegerOverflow(input.to_owned()))?;
        return Ok(number.into());
    }
    Ok(match input.parse::<u64>() {
        Ok(number) => number.into(),
        Err(_) => Value::from_finite_f64(input.parse::<f64>().unwrap()),
    })
}
fn parse_number ( input : & str ) -> Result < Value , Error > { if let Some ( " " | " " ) = input . get ( .. 2 ) { let number = u64 :: from_str_radix ( & input [ 2 .. ] , 16 ) . map_err ( | _ | Error :: IntegerOverflow ( input . to_owned ( ) ) ) ? ; return Ok ( number . into ( ) ) ; } Ok ( match input . parse :: < u64 > ( ) { Ok ( number ) => number . into ( ) , Err ( _ ) => Value :: from_finite_f64 ( input . parse :: < f64 > ( ) . unwrap ( ) ) , } ) }
Parses a number (integer or floating-point number) into a value.
Parses a number ( integer or floating - point number ) into a value .
input
&str
input
&str