re_build_tools

Function write_file_if_necessary

Source
pub fn write_file_if_necessary(
    path: impl AsRef<Path>,
    content: &[u8],
) -> Result<()>
Expand description

Writes content to a file iff it differs from what’s already there.

This prevents recursive feedback loops where one generates source files from build.rs, which in turn triggers cargo’s implicit rerun-if-changed=src/** clause.