From 50590208fffdc17cd049e1e65f9b293a56343dd5 Mon Sep 17 00:00:00 2001 From: Alexander Batischev Date: Wed, 21 Jul 2021 21:35:27 +0300 Subject: Replace GenerationChunkResult with plain Result --- src/chunk.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/chunk.rs') diff --git a/src/chunk.rs b/src/chunk.rs index 8631fd9..469185f 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -51,15 +51,12 @@ pub enum GenerationChunkError { JsonGenerate(serde_json::Error), } -/// A result from a chunk operation. -pub type GenerationChunkResult = Result; - impl GenerationChunk { pub fn new(chunk_ids: Vec) -> Self { Self { chunk_ids } } - pub fn from_data_chunk(chunk: &DataChunk) -> GenerationChunkResult { + pub fn from_data_chunk(chunk: &DataChunk) -> Result { let data = chunk.data(); let data = std::str::from_utf8(data)?; serde_json::from_str(data).map_err(GenerationChunkError::JsonParse) @@ -77,7 +74,7 @@ impl GenerationChunk { self.chunk_ids.iter() } - pub fn to_data_chunk(&self, ended: &str) -> GenerationChunkResult { + pub fn to_data_chunk(&self, ended: &str) -> Result { let json: String = serde_json::to_string(self).map_err(GenerationChunkError::JsonGenerate)?; let bytes = json.as_bytes().to_vec(); -- cgit v1.2.1