Struct atomicwrites::AtomicFile [] [src]

pub struct AtomicFile {
    // some fields omitted
}

Methods

impl AtomicFile
[src]

fn new<P: AsRef<Path>>(path: P, overwrite: OverwriteBehavior) -> Self

Helper for writing to path in write-only mode.

If DisallowOverwrite is given, errors will be returned from self.write(...) if the file exists.

fn new_with_tmpdir<P: AsRef<Path>>(path: P, overwrite: OverwriteBehavior, tmpdir: P) -> Self

fn path(&self) -> &Path

Get the target filepath.

fn write<E, F: FnMut(&mut File) -> Result<E>>(&self, f: F) -> Result<E>

Open a temporary file, call f on it (which is supposed to write to it), then move the file atomically to self.path.