Function parse_unsigned

Source
pub fn parse_unsigned(input: &str) -> IResult<&str, u32>
Expand description

Parse an unsigned 32-bit integer from a string.

This function parses a sequence of digits into a u32 value. It’s primarily used for parsing array indices and other non-negative integer values in the expression grammar.

§Arguments

  • input - A string slice containing digits to parse

§Returns

  • IResult<&str, u32> - A nom result containing the remaining input and parsed u32 value

§Examples

use aimx::literals::number::parse_unsigned;
 
assert_eq!(parse_unsigned("123"), Ok(("", 123)));
assert_eq!(parse_unsigned("0"), Ok(("", 0)));