Function chomp::ascii::decimal [] [src]

pub fn decimal<I: Input<Token = u8>, T: Copy + ValueFrom<u8, Err = NoError> + Add<Output = T> + Mul<Output = T>>(
    i: I
) -> SimpleResult<I, T>

Parses a series of digits and converts them to an integer.

Note

The T type must be larger than u8 if it is signed.

Example

use chomp::parse_only;
use chomp::ascii::decimal;

let r = parse_only(decimal::<_, u8>, b"123");

assert_eq!(r, Ok(123u8));