Skip to main content

write_with_backup

Function write_with_backup 

Source
pub fn write_with_backup(
    doc: &Document,
    path: &Path,
    config: &Config,
) -> Result<()>
Expand description

Atomically write a Document to path, creating a backup first.

Steps:

  1. If the file already exists, create a timestamped backup.
  2. Prune old backups beyond history_size.
  3. Sort entries according to config, then write the document atomically.