atomicwrites 0.0.8

Atomic file-writes.
docs.rs failed to build atomicwrites-0.0.8
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: atomicwrites-0.4.3

rust-atomicwrites

Build Status Windows build status

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")
}));

I'm not at all satisfied with this API, but there doesn't seem to be a different way to force the user to check for errors when closing the file. See the relevant RFC discussion, suggestions in the issue tracker on how to improve the API are welcome too.

License

Licensed under MIT, see LICENSE.