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

pub fn decimal<T: Copy + ValueFrom<u8, Err=NoError> + Add<Output=T> + Mul<Output=T>>(i: Input<u8>) -> U8Result<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(|i| {
    decimal::<u8>(i)
}, b"123");

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