Skip to main content

write_package

Function write_package 

Source
pub fn write_package(
    output_path: &Path,
    package: &GeneratedPackage,
) -> Result<()>
Expand description

Write every file of package, then remove the files an earlier run left in the companion directory that this run does not produce.

The companion directory is audited before anything is written, so a run that refuses leaves every file it would have replaced intact.

ยงErrors

Returns Error::WriteOutput when a file cannot be written, and Error::UnownedOutput when the companion directory holds a file the generator did not write. Refusing is deliberate: the directory belongs to the generator, and deleting a hand-written file that landed in it would lose work.