ArchUnitRust

Write the sentence your team already says — the API must not reach the database — as an ordinary Rust test, and let cargo test show the dependency evidence when the code disagrees.

use archunit::{assert_passes, project_files};

#[test]
fn api_does_not_reach_database() {
    let rule = project_files()
        .in_path("src/api/**")
        .should_not()
        .depend_on_files()
        .in_path("src/database/**");

    assert_passes!(rule);
}

There is no configuration file, registry, or test adapter. A rule is an immutable value. Building one reads nothing; assert_passes! or Checkable::check locates the Cargo project, extracts the graph, and evaluates the rule.

Install

ArchUnitRust 0.0.2 installs from crates.io as a development dependency and requires Rust 1.85 or newer:

cargo add --dev archunit@0.0.2

The equivalent manifest entry is archunit = "0.0.2" under [dev-dependencies]. Cargo records the resolved registry version in Cargo.lock.

Your first rule

Put architecture tests in tests/architecture.rs, change the paths in the opening example to match the project, then run:

cargo test --test architecture

Three details matter before the second rule:

Where to go next

The generated Rust API reference sits beside this guide. The source code and its public doc comments remain the authority when a guide explanation and a symbol signature differ.