Expand description
Build-time helper for acta.
Call from your build.rs to compute a sensible default path_width for
acta::Formatter based on the longest source-file path in your project.
§Example
Add to your Cargo.toml:
[build-dependencies]
acta-build = "0.1"In build.rs:
let width = acta_build::walk_src_max_width("src", "src/");
println!("cargo:rustc-env=ACTA_PATH_WIDTH={width}");
println!("cargo:rerun-if-changed=src");Then in your code:
ⓘ
let width: usize = env!("ACTA_PATH_WIDTH").parse().unwrap_or(40);
let formatter = acta::Formatter::new().with_path_width(width);Functions§
- walk_
src_ max_ width - Walk
dirrecursively, find every.rsfile, and returnmax(path_len_after_stripping(strip_prefix)) + 4.