Crate version_sync

source ·
Expand description

version-sync provides macros for keeping version numbers in sync with your crate version.

Library Overview

When making a release of a Rust project, you typically need to adjust some version numbers in your code and documentation. This crate gives you macros that covers some typical cases where version numbers need updating:

Except for assert_contains_substring, the macros are gated behind individual features, as detailed below.

A typical configuration will use an integration test to verify that all version numbers are in sync. Create a tests/ file with:

fn test_readme_deps_updated() {

fn test_readme_mentions_version() {
    version_sync::assert_contains_substring!("", "Version {version}");

fn test_html_root_url() {

When you run cargo test, your version numbers will be automatically checked.

Cargo Features

In case you only need some of the macros above, you can disable them individually using Cargo features. The features are:

All of these features are enabled by default. If you disable all of them, you can still use assert_contains_substring to quickly check that a given file contains the current crate version.