semver

Rust parser and evaluator for Cargo's flavor of Semantic Versioning

Library
Cargo
v1.0.28
673 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
45 /100 Fair
Development Activity 12
Maintenance 20
Community 68
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 80
Code Quality 85
Innovation 60
Learning Curve 85

The semver crate is the reference Rust implementation for parsing and evaluating Semantic Versioning strings and version requirements, matching Cargo’s own interpretation of the SemVer spec. It exposes Version and VersionReq types that parse strings like 1.2.3-alpha.1+build5 and requirement expressions like >=1.2.3, <1.8.0, then evaluate whether a given version satisfies a requirement.

Written and maintained by David Tolnay, this is the same crate Cargo itself uses internally for dependency resolution, making it the de facto standard for any Rust tool that needs to work with version numbers or version constraints in a way that’s compatible with the crates.io ecosystem.

What You Get

  • Version and VersionReq types with parse() methods for version strings and requirement expressions
  • Full support for pre-release and build-metadata identifiers per the SemVer 2.0 spec
  • Comparison and ordering implementations (Ord, PartialOrd) for Version following SemVer precedence rules
  • Optional serde feature for serializing/deserializing versions and requirements
  • no_std compatibility via the default-toggleable std feature

Common Use Cases

  • Parsing and validating version numbers supplied by users, config files, or package manifests
  • Implementing dependency resolution or compatibility checks that need to evaluate whether an installed version satisfies a stated requirement
  • Building Cargo-adjacent tooling (linters, dependency auditors, build scripts) that needs to interpret Cargo.toml version requirements identically to Cargo itself
  • Embedding version-aware feature gating or migration logic in libraries and CLIs

Under The Hood

Architecture The crate is organized into focused modules under src/: parse.rs handles the recursive-descent parsing of both Version and VersionReq grammars, eval.rs implements the requirement-matching logic (checking a Version against a VersionReq’s comparator list), identifier.rs provides a specialized small-string type for pre-release/build-metadata identifiers to avoid heap allocation in the common case, display.rs implements Display/Debug formatting, and impls.rs/serde.rs add trait implementations (Ord, Hash, optional serde::Serialize/Deserialize). lib.rs (569 lines) defines the core Version/VersionReq/Comparator/Prerelease/BuildMetadata types and re-exports the public API.

Tech Stack Pure Rust with edition 2021, zero required dependencies, and an optional serde_core dependency gated behind the serde feature; the crate supports no_std environments by default-toggling the std feature off. A build.rs script and criterion-based benchmarks (benches/parse.rs) track parsing performance, and a fuzz/ directory holds cargo-fuzz targets for the parser, reflecting the correctness-critical nature of version parsing for the wider Cargo ecosystem.

Code Quality The crate has a dedicated tests/ directory alongside fuzz targets specifically exercising the parser against malformed input, an important quality bar given that this crate underpins Cargo’s own dependency resolution. Code is organized into small, single-responsibility modules (identifier.rs at 412 lines is the largest besides lib.rs), and the specialized Identifier type in identifier.rs shows deliberate attention to avoiding unnecessary allocations in a hot-path parsing library.

API Design The public API is small and idiomatic: Version::parse(&str) and VersionReq::parse(&str) return Result types, and VersionReq::matches(&Version) is the primary evaluation entry point, requiring no configuration to get started. Because it mirrors Cargo’s own internal version-handling exactly, the API surface is intentionally unsurprising to any Rust developer already familiar with how Cargo.toml dependency version constraints behave.

Used by 15 apps in this directory

Rust
86%
Apache 2.0

mesh-llm

AI Agents · AI Development

3,551

Mesh LLM pools GPUs and memory across every machine you own into one OpenAI-compatible API, so agents tap distributed compute instead of a single GPU box or a metered cloud bill.

View details
85
Repo Health
91
Technical
69
Dependency
Built with
Rust 86%
TypeScript 10%
Updated 6 days ago
Rust
59%
GPL 3.0

openfootmanager

Game Development

1,161

A free and open source football management simulation game built with Rust and Tauri, inspired by Football Manager.

View details
94
Repo Health
79
Technical
73
Dependency
Built with
Rust 59%
TypeScript 40%
Updated 1 weeks ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated 6 days ago
TypeScript
67%
Apache 2.0

tabularis

Databases · Developer Tools

5,270

Open-source desktop SQL workspace with built-in PostgreSQL, MySQL, and SQLite drivers, SQL notebooks, a visual query builder, and a built-in MCP server for AI agents like Claude and Cursor.

View details
84
Repo Health
89
Technical
66
Dependency
Built with
TypeScript 67%
Rust 31%
Updated 6 days ago
Python
73%
Apache 2.0

Unsloth

AI Assistants · AI Development

78,493

Run and fine-tune LLMs, diffusion, audio and embedding models on your own hardware, from a native desktop app, a browser UI, or a Python library.

View details
89
Repo Health
83
Technical
70
Dependency
Built with
Python 73%
TypeScript 22%
Updated 6 days ago
Rust
83%
AGPL 3.0

Vaultwarden

Password Manager · Security

69,556

Unofficial Bitwarden-compatible server in Rust — run the full Bitwarden ecosystem on a Raspberry Pi using every official client you already have, without the multi-container overhead.

View details
89
Repo Health
69
Technical
69
Dependency
Built with
Rust 83%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers