parse_int

Function parse_int 

Source
pub fn parse_int(value: &str, field_name: &str) -> Result<i64>
Expand description

Parse string to integer with context

Returns a detailed error message on failure.

ยงExample

assert_eq!(parse_int("42", "count").unwrap(), 42);
assert_eq!(parse_int("-10", "offset").unwrap(), -10);
assert!(parse_int("abc", "count").is_err());