Evaluating Cargo script syntax proposals
Channel: timClicks
Date: 2024-01-26

The Cargo team are investigating options for adding some new syntax to single-file Rust programs to enable dependencies to be provided in the same place as the cose. The discussion has hit a bit of an impasse and they've asked for my impressions. So there they are (live, unscripted).

The two programs I'm using to evaluate them:

///

use fastrand;

fn main() {
    if fastrand::bool() {
        println!("Hello")
    }
}


///

use regex::Regex;

fn main() {
    let re = Regex::new(r"\b\w+\b").unwrap();
    
    let text = "Zero-cost abstractions is an unhelpful term.";
    
    let word_count = re.find_iter(text).count();
    println!("{word_count}")
}