From cf01169e467f4ac36d2d8b9ce13e7bbc81d46aa5 Mon Sep 17 00:00:00 2001 From: Mel Date: Sat, 2 Oct 2021 21:30:03 +0200 Subject: Immutable Fs implementation and replaced exists calls. --- src/history.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/history.rs') diff --git a/src/history.rs b/src/history.rs index 4f23790..d023330 100644 --- a/src/history.rs +++ b/src/history.rs @@ -13,7 +13,7 @@ pub struct RepositoryHistory { } impl RepositoryHistory { - pub fn from_file(fs: &mut FS, file: &mut FS::File) -> Result { + pub fn from_file(fs: &FS, file: &mut FS::File) -> Result { let buffer = fs .read_from_file(file) .context("Failed reading repository history.")?; @@ -22,7 +22,7 @@ impl RepositoryHistory { repository_history.context("Corrupted repository history.") } - pub fn write_to_file(&self, fs: &mut FS, file: &mut FS::File) -> anyhow::Result<()> { + pub fn write_to_file(&self, fs: &FS, file: &mut FS::File) -> anyhow::Result<()> { let encoded: Vec = serde_json::to_vec(self)?; fs.write_to_file(file, encoded)?; Ok(()) @@ -58,7 +58,7 @@ pub struct FileHistory { } impl FileHistory { - pub fn from_file(fs: &mut FS, file: &mut FS::File) -> Result { + pub fn from_file(fs: &FS, file: &mut FS::File) -> Result { let buffer = fs .read_from_file(file) .context("Failed reading file history.")?; @@ -67,7 +67,7 @@ impl FileHistory { file_history.context("Corrupted file history.") } - pub fn write_to_file(&self, fs: &mut FS, file: &mut FS::File) -> Result<()> { + pub fn write_to_file(&self, fs: &FS, file: &mut FS::File) -> Result<()> { let encoded: Vec = serde_json::to_vec(self)?; fs.write_to_file(file, encoded)?; Ok(()) -- cgit 1.4.1