summaryrefslogtreecommitdiff
path: root/src/parsers.rs
blob: 7e8ecc9cfc7b0e626c4f9f246b0982cd5ca3a2d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use nom::{character::complete::digit1, combinator::map_res, IResult};
use std::str::FromStr;

pub fn u64(input: &str) -> IResult<&str, u64> {
    map_res(digit1, u64::from_str)(input)
}

pub fn i64(input: &str) -> IResult<&str, i64> {
    map_res(digit1, i64::from_str)(input)
}

pub fn u32(input: &str) -> IResult<&str, u32> {
    map_res(digit1, u32::from_str)(input)
}

pub fn i32(input: &str) -> IResult<&str, i32> {
    map_res(digit1, i32::from_str)(input)
}