cicero_path

Crates.iocicero_path
lib.rscicero_path
version0.4.1
created_at2025-02-01 21:01:17.516161+00
updated_at2025-05-19 17:51:01.545191+00
descriptionAccess paths relevant for CI code.
homepage
repositoryhttps://codeberg.org/trem/cicero/
max_upload_size
id1539009
size10,468
(trem-rs)

documentation

README

Cicero Path

Access paths in your repository, with compile-time checks.

use cicero_path::repo_path;

let readme = repo_path!("README.md");
let doc_index = repo_path!("doc/src/index.md");

The macro checks whether the path exists and constructs a PathBuf. If the path does not exist, the compiler will error during compilation:

use cicero_path::repo_path;

let non_existent = repo_path!("non/existent/path.txt");

This allows you to move files around without having to worry that a reference silently breaks, similar to the way std::include!() works.

How it works

During compilation, the macro looks for the .git directory to determine the root of your repository.
Then it joins the path you specified to the root and checks if the resulting path exists.

The path of your repository root is cached during compilation, so that you can use repo_path!() many times without a significant compile-time burden.

Commit count: 0

cargo fmt