Apply previously rendered bytes to one working-copy file.
(
working_copy: &W,
rendered: RenderedFile,
flush_after_write: bool,
)
| 721 | |
| 722 | /// Apply previously rendered bytes to one working-copy file. |
| 723 | pub(crate) fn apply_rendered_file<W>( |
| 724 | working_copy: &W, |
| 725 | rendered: RenderedFile, |
| 726 | flush_after_write: bool, |
| 727 | ) -> Result<FileOutputResult, FileOutputError<W::Error>> |
| 728 | where |
| 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 | /// |
no test coverage detected