rust-atomicwrites
Atomic file-writes. Works on both POSIX and Windows.
The basic idea is to write to temporary files, and move them when done writing.
This avoids the problem of two programs writing to the same file. For
AllowOverride, link + unlink is used instead of rename to raise errors
when the target path already exists.
Example
use atomicwrites::{AtomicFile,DisallowOverwrite};
let af = AtomicFile::new("foo", DisallowOverwrite);
try!(af.write(|f| {
f.write_all(b"HELLO")
}));
License
Licensed under MIT, see LICENSE.