Function parse_eval

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

Parse an evaluation value from string input.

This function parses a string representation of an evaluation value in the format "score, count", where both score and count are unsigned integers. The input is expected to be a comma-separated pair of numbers with optional whitespace around the comma.

§Arguments

  • input - The input string to parse. Expected format: "score, count"

§Returns

Returns an IResult<&str, Value> containing the remaining input and the parsed evaluation value as a crate::value::Value::Eval variant.

§Examples

use aimx::values::parse_eval;

let input = "7, 10";
let (remaining, eval_value) = parse_eval(input).unwrap();
assert!(remaining.is_empty());
assert!(eval_value.is_eval());
 
// Also accepts formats without spaces
let input = "5,8";
let (_, eval_value) = parse_eval(input).unwrap();
assert!(eval_value.is_eval());