Radar · Rust · Archive · Week 17 · Apr 20 – 26, 2026
Tooling: Building Semantic Version Control in Rust
Nice to knowtooling
- What changed
- The blog referenced a project on building semantic version control in Rust.
- Production impact
- The source does not say.
- Try it
- Explore the repository and read the README.
- Source
- this-week-in-rust.org/blog/2026/04/22/this-week-in-rust-648/
Understand it, then run it
Run it now
// This program demonstrates a minimal semantic version parser and comparator.
// It does not use any external crates because Rust 1.98.1 (edition 2024) has no
// built‑in semver support. The logic is intentionally simple: it parses
// "major.minor.patch" where each part is a non‑negative integer.
fn parse_semver(s: &str) -> Option<(usize, usize, usize)> {
let parts: Vec<&str> = s.split('.').collect();
if parts.len() != 3 {
return None;
}
let major = parts[0].parse::<usize>().ok()?;
let minor = parts[1].parse::<usize>().ok()?;
let patch = parts[2].parse::<usize>().ok()?;
Some((major, minor, patch))
}
fn bump_major(v: (usize, usize, usize)) -> (usize, usize, usize) {
(v.0 + 1, 0, 0)
}
fn bump_minor(v: (usize, usize, usize)) -> (usize, usize, usize) {
(v.0, v.1 + 1, 0)
}
fn bump_patch(v: (usize, usize, usize)) -> (usize, usize, usize) {
(v.0, v.1, v.2 + 1)
}
fn main() {
let version_str = "1.4.2";
let version = parse_semver(version_str).expect("invalid semver");
println!("Parsed: {:?}", version);
let major_bumped = bump_major(version);
let minor_bumped = bump_minor(version);
let patch_bumped = bump_patch(version);
println!("Major bumped: {:?}", major_bumped);
println!("Minor bumped: {:?}", minor_bumped);
println!("Patch bumped: {:?}", patch_bumped);
}
What it printed when we ran it on Rust 1.98.1 (edition 2024)
Parsed: (1, 4, 2) Major bumped: (2, 0, 0) Minor bumped: (1, 5, 0) Patch bumped: (1, 4, 3)
Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.
Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed