composer_semver/lib.rs
1//! Composer-flavored semver primitives: [`Version`], [`Constraint`],
2//! [`Stability`], [`Bound`].
3//!
4//! A faithful Rust port of `composer/semver` — the version
5//! normalization, comparison, and constraint algebra that Composer
6//! itself uses. It mirrors `VersionParser::normalize`,
7//! `Comparator::compare`, and `VersionParser::parseConstraints`
8//! against a pinned upstream commit (see `version.rs`), with the
9//! upstream data-provider cases committed as Layer 1 conformance
10//! fixtures (`tests/data/conformance.json`).
11//!
12//! It is the shared substrate for the `cresset-tools` Composer
13//! stack — the `bougie` package manager (PHP/ext picker + dep
14//! resolver) and the `sconce` repository server/mirror (version
15//! sorting + constraint-based mirror subscriptions) — so the
16//! constraint algebra is defined once here rather than re-derived,
17//! drifting, in each.
18
19// This crate is a close port of `composer/semver`. A few nested conditionals
20// and match arms are deliberately kept in the upstream shape — even where
21// clippy would collapse or merge them — so the Rust stays auditable against
22// the PHP source (e.g. the one-arm-per-`Suffix` sort table in `version.rs`,
23// and `~X` vs `~X.Y` written as separate cases per the comment in
24// `constraint.rs`). Allowing the two lints crate-wide keeps that shape without
25// scattering per-site `#[allow]`s.
26#![allow(clippy::collapsible_if, clippy::match_same_arms)]
27
28pub mod bound;
29pub mod constraint;
30pub mod stability;
31pub mod version;
32
33pub use bound::Bound;
34pub use constraint::Constraint;
35pub use stability::Stability;
36pub use version::Version;