Skip to main content

Module output_file

Module output_file 

Source
Expand description

A file written whole or not at all.

OutputFile writes to a private temporary file beside the destination and moves it into place in OutputFile::commit. Until then the destination is untouched: a failure while serializing, finishing an encoder or flushing leaves the old file’s bytes and permissions as they were, and a new export leaves no partial file. Dropping an uncommitted OutputFile, including in a panic, removes the temporary file.

The file is synced before the rename, since some write errors (a network filesystem’s quota, a disk’s I/O error) are reported only then. The rename itself is not, so a power cut just after it can still lose the new file.

Every file datui writes for the user goes through here: data exports, the Data Quality report and chart images.

Structs§

OutputFile
A file being written to a temporary sibling of its destination.

Enums§

Overwrite
What the commit may do to a file already at the destination.
Refused
Why OutputFile would not write a destination. Carried inside the io::Error, whose kind says the same to code that matches on kinds; its text is for the user and leaves the path to the caller.