Skip to main content

export

Function export 

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

Write a pretty-printed ironprint.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 ironprint.json written to $OUT_DIR; the binary always embeds the $OUT_DIR copy. Pass false, or condition the call on cfg!(debug_assertions), to suppress the file in release builds.

§Concerns

The exported file contains the full dependency graph, per-file source hashes, target triple, and compiler version. Add ironprint.json to .gitignore to prevent unintentional commits. If an error occurs and enabled is true, the file may be partially written; the error is propagated to the caller.

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