Skip to main content

generate_project_metadata_and_linker_script

Function generate_project_metadata_and_linker_script 

Source
pub fn generate_project_metadata_and_linker_script() -> Result<(), Box<dyn Error>>
Expand description

Zero-configuration build-script entry point.

Reads metadata from Cargo.toml, env overrides, git, and OS release info, then embeds it via embed_package_metadata with EmbedOptions::default(). Reach for embed_package_metadata directly when you need to supply metadata programmatically or suppress the cargo:rustc-link-arg directive.

§IMPORTANT

Only call from build.rs. Cargo sets OUT_DIR and related variables for build scripts; outside that context the call will fail.

§Example

// In build.rs
fn main() -> Result<(), Box<dyn std::error::Error>> {
    module_info::generate_project_metadata_and_linker_script()?;
    Ok(())
}

§Errors

Returns an error if metadata generation or file operations fail.