parse

Function parse 

Source
pub fn parse<N: FromLexical>(bytes: &[u8]) -> Result<N>
Available on crate features parse-floats or parse-integers only.
Expand description

Parse complete number from string.

This method parses the entire string, returning an error if any invalid digits are found during parsing.

  • bytes - Byte slice containing a numeric string.

ยงExamples

let string = "3.14159265359";
let result = lexical_core::parse::<f32>(string.as_bytes());
assert_eq!(result, Ok(3.14159265359_f32));