Skip to main content

Module file

Module file 

Source
Expand description

Format-neutral in-memory document value, plus a file-backed document facade with safe, source-preserving edits.

DocumentFile lifts the file-safety and source-preserving edit orchestration that previously lived only in a CLI binary: mutation methods refuse to write through a symlink or (on unix) a hardlinked file, and every write goes to a same-directory temp file that is fsynced, has the original file’s permissions re-applied, and is atomically renamed over the target — so a crash or error mid-write never leaves a partial file.

This module never redacts values on decode/encode/save/edit — it reads and writes raw values as-is; redaction is the caller’s responsibility.

§Capability matrix

Structs§

Document
A format-neutral in-memory document: a parsed Value plus the Format it was parsed from. Has no file or stdin coupling — construct it from a string or any std::io::Read the caller supplies.
DocumentFile
A file-backed document: owns the path, format, original source text, and parsed value.