diff --git a/src/persist.rs b/src/persist.rs index 877d5fc..33b10c7 100644 --- a/src/persist.rs +++ b/src/persist.rs @@ -18,16 +18,6 @@ pub struct FilePersist { path: PathBuf, } -fn create(path: &Path, mode: u32) -> Result { - OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .mode(mode) - .open(path) - .map_err(Error::from) -} - impl FilePersist { pub fn new(config: &Config) -> FilePersist { FilePersist { @@ -204,6 +194,16 @@ impl FilePersist { } } +fn create(path: &Path, mode: u32) -> Result { + OpenOptions::new() + .write(true) + .create(true) + .truncate(true) + .mode(mode) + .open(path) + .map_err(Error::from) +} + fn write(path: &Path, mode: u32, data: &[u8]) -> Result<()> { let mut f = create(&path, mode)?; f.write_all(data)?;