Function nom::number::complete::double [−][src]
pub fn double<T, E: ParseError<T>>(input: T) -> IResult<T, f64, E> where
T: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>>,
T: Clone + Offset,
T: InputIter + InputLength + ParseTo<f64>,
<T as InputIter>::Item: AsChar,
T: InputTakeAtPosition,
<T as InputTakeAtPosition>::Item: AsChar,
Recognizes floating point number in a byte string and returns a f64
complete version: can parse until the end of input
use nom::number::complete::double; let parser = |s| { double(s) }; assert_eq!(parser("11e-1"), Ok(("", 1.1))); assert_eq!(parser("123E-02"), Ok(("", 1.23))); assert_eq!(parser("123K-01"), Ok(("K-01", 123.0))); assert_eq!(parser("abc"), Err(Err::Error(("abc", ErrorKind::Char))));