Command-line tools receive text arguments. A parser converts the text into typed values before the program uses them.

Program

Play the program to choose the raw limit argument, parse it, and print the typed value.

parse_limit_arg.rs
fn main() {
    let raw_limit = ;
    let args = ["egtry", "--limit", raw_limit];
    let limit = parse_limit(&args);
    println!("limit={limit}");
}

fn parse_limit(args: &[&str]) -> i32 {
    args[2].parse::<i32>().unwrap()
}
fn main() {
    let raw_limit = ;
    let args = ["egtry", "--limit", raw_limit];
    let limit = parse_limit(&args);
    println!("limit={limit}");
}

fn parse_limit(args: &[&str]) -> i32 {
    args[2].parse::<i32>().unwrap()
}
fn main() {
    let raw_limit = ;
    let args = ["egtry", "--limit", raw_limit];
    let limit = parse_limit(&args);
    println!("limit={limit}");
}

fn parse_limit(args: &[&str]) -> i32 {
    args[2].parse::<i32>().unwrap()
}
text input Command-line arguments arrive as strings.
parse `parse::<i32>()` converts the selected text into a number.
helper `parse_limit` keeps argument extraction separate from the main flow.