Evaluating Cargo script syntax proposals

Опубликовано: 13 Март 2026
на канале: timClicks
861
34

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}")
}