diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-15 18:12:50 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-09-18 17:52:36 +0300 |
commit | 6ed6b1bc75b1995a7740ff28bc26a908b91f37c8 (patch) | |
tree | 48575e9335123d5f6a228038f71565e42dbf9366 /src/chunk.rs | |
parent | d6728974b98a821b8d633197abd97cf2fc9357f5 (diff) | |
download | obnam2-6ed6b1bc75b1995a7740ff28bc26a908b91f37c8.tar.gz |
refactor: define a Checksum type and use it where appropriate
This will make it harder to compare, say, a SHA-256 and a SHA3, later,
when we add more checksum types.
Sponsored-by: author
Diffstat (limited to 'src/chunk.rs')
-rw-r--r-- | src/chunk.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/chunk.rs b/src/chunk.rs index 469185f..266d1a7 100644 --- a/src/chunk.rs +++ b/src/chunk.rs @@ -1,4 +1,4 @@ -use crate::checksummer::sha256; +use crate::checksummer::Checksum; use crate::chunkid::ChunkId; use crate::chunkmeta::ChunkMeta; use serde::{Deserialize, Serialize}; @@ -78,7 +78,7 @@ impl GenerationChunk { let json: String = serde_json::to_string(self).map_err(GenerationChunkError::JsonGenerate)?; let bytes = json.as_bytes().to_vec(); - let sha = sha256(&bytes); + let sha = Checksum::sha256(&bytes); let meta = ChunkMeta::new_generation(&sha, ended); Ok(DataChunk::new(bytes, meta)) } |