MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / apply_rendered_file

Function apply_rendered_file

atomic-core/src/output/repo/file.rs:723–741  ·  view source on GitHub ↗

Apply previously rendered bytes to one working-copy file.

(
    working_copy: &W,
    rendered: RenderedFile,
    flush_after_write: bool,
)

Source from the content-addressed store, hash-verified

721
722/// Apply previously rendered bytes to one working-copy file.
723pub(crate) fn apply_rendered_file<W>(
724 working_copy: &W,
725 rendered: RenderedFile,
726 flush_after_write: bool,
727) -> Result<FileOutputResult, FileOutputError<W::Error>>
728where
729 W: WorkingCopy,
730 W::Writer: Write,
731{
732 let RenderedFile { bytes, result } = rendered;
733 let mut writer = working_copy
734 .write_file(&result.path, result.inode)
735 .map_err(FileOutputError::WorkingCopy)?;
736 writer.write_all(&bytes)?;
737 if flush_after_write {
738 writer.flush()?;
739 }
740 Ok(result)
741}
742
743/// Output a file to a buffer instead of the working copy.
744///

Callers 2

output_file_with_filterFunction · 0.85
materialize_viewFunction · 0.85

Calls 2

write_fileMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected