From 2f13fae6d943e4408dad6c1f689e1ecfc369e314 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Wed, 21 Jul 2021 22:25:28 +0300 Subject: Replace StoreResult with plain Result --- src/store.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/store.rs b/src/store.rs index bccecc7..830074e 100644 --- a/src/store.rs +++ b/src/store.rs @@ -14,9 +14,6 @@ pub struct Store { /// An error from a `Store` operation. pub type StoreError = std::io::Error; -/// A result from an `Store` operation. -pub type StoreResult = Result; - impl Store { /// Create a new Store to represent on-disk storage of chunks.x pub fn new(dir: &Path) -> Self { @@ -42,7 +39,7 @@ impl Store { } /// Save a chunk into a store. - pub fn save(&self, id: &ChunkId, chunk: &DataChunk) -> StoreResult<()> { + pub fn save(&self, id: &ChunkId, chunk: &DataChunk) -> Result<(), StoreError> { let (dir, metaname, dataname) = &self.filenames(id); if !dir.exists() { @@ -55,7 +52,7 @@ impl Store { } /// Load a chunk from a store. - pub fn load(&self, id: &ChunkId) -> StoreResult { + pub fn load(&self, id: &ChunkId) -> Result { let (_, metaname, dataname) = &self.filenames(id); let meta = std::fs::read(&metaname)?; let meta = serde_json::from_slice(&meta)?; @@ -66,7 +63,7 @@ impl Store { } /// Delete a chunk from a store. - pub fn delete(&self, id: &ChunkId) -> StoreResult<()> { + pub fn delete(&self, id: &ChunkId) -> Result<(), StoreError> { let (_, metaname, dataname) = &self.filenames(id); std::fs::remove_file(&metaname)?; std::fs::remove_file(&dataname)?; -- cgit v1.2.1