pub fn rewrite(
dir: &Path,
name: &str,
change: impl FnOnce(&str) -> String,
) -> Result<()>Expand description
Replaces dir/name with change of its text (empty when there is no file yet). Writers take
turns on name.lock, a file that is never replaced, so no write is lost. Readers don’t lock:
the rename swaps in the whole file at once.