Struct atomicwrites::AtomicFile
[−]
[src]
pub struct AtomicFile { /* fields omitted */ }
Methods
impl AtomicFile
[src]
fn new<P: AsRef<Path>>(path: P, overwrite: OverwriteBehavior) -> Self
[src]
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
[src]
path: P,
overwrite: OverwriteBehavior,
tmpdir: P
) -> Self
fn path(&self) -> &Path
[src]
Get the target filepath.
fn write<T, E, F>(&self, f: F) -> Result<T, Error<E>> where
F: FnOnce(&mut File) -> Result<T, E>,
[src]
F: FnOnce(&mut File) -> Result<T, E>,
Open a temporary file, call f
on it (which is supposed to write to it), then move the
file atomically to self.path
.