Skip to main content

export

Function export 

Source
pub fn export(enabled: bool) -> Result<(), BuildTimeFingerprintError>
Expand description

Write a pretty-printed fingerprint.json alongside the crate’s Cargo.toml when enabled is true.

This file is intended for local inspection only. It is distinct from the compact fingerprint.json written to $OUT_DIR; the binary always embeds the $OUT_DIR copy.

Tip: prefer passing true to generate_fingerprint instead of calling both functions, as generate_fingerprint(true) only runs cargo metadata once.

§Concerns

The exported file contains the full dependency graph, per-file source hashes, target triple, and compiler version. Add fingerprint.json to .gitignore to prevent unintentional commits. The write is atomic (written to a .tmp file then renamed).

fn main() {
    toolkit_zero::dependency_graph::build::generate_fingerprint(false)
        .expect("fingerprint generation failed");
    toolkit_zero::dependency_graph::build::export(cfg!(debug_assertions))
        .expect("fingerprint export failed");
}