1
Fork 0

Use the full Fingerprint when stringifying Svh

This commit is contained in:
Ben Kimock 2023-04-30 14:28:30 -04:00
parent 43a78029b4
commit 3c6d9ec77d
3 changed files with 11 additions and 6 deletions

View file

@ -23,18 +23,18 @@ impl Svh {
Svh { hash }
}
pub fn as_u64(&self) -> u64 {
self.hash.to_smaller_hash().as_u64()
pub fn as_u128(self) -> u128 {
self.hash.as_u128()
}
pub fn to_string(&self) -> String {
format!("{:016x}", self.hash.to_smaller_hash())
pub fn to_hex(self) -> String {
format!("{:032x}", self.hash.as_u128())
}
}
impl fmt::Display for Svh {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad(&self.to_string())
f.pad(&self.to_hex())
}
}