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/chunkid.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/chunkid.rs')
-rw-r--r-- | src/chunkid.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/chunkid.rs b/src/chunkid.rs index 2f67d79..39e3ee1 100644 --- a/src/chunkid.rs +++ b/src/chunkid.rs @@ -1,4 +1,4 @@ -use crate::checksummer::sha256; +use crate::checksummer::Checksum; use rusqlite::types::ToSqlOutput; use rusqlite::ToSql; use serde::{Deserialize, Serialize}; @@ -46,8 +46,8 @@ impl ChunkId { self.id.as_bytes() } - pub fn sha256(&self) -> String { - sha256(self.id.as_bytes()) + pub fn sha256(&self) -> Checksum { + Checksum::sha256(self.id.as_bytes()) } } |