impl Hashable for Path, not just PathBuf

feat/vaults
Tomáš Mládek 2022-01-18 16:59:59 +01:00
parent b3b6c2d2a8
commit 1521f25132
No known key found for this signature in database
GPG Key ID: ED21612889E75EC5
1 changed files with 4 additions and 4 deletions

View File

@ -8,7 +8,7 @@ use diesel::{deserialize, sql_types};
use filebuffer::FileBuffer;
use log::trace;
use serde::{ser, Serialize, Serializer};
use std::path::PathBuf;
use std::path::{PathBuf, Path};
use tiny_keccak::{Hasher, KangarooTwelve};
#[derive(Debug, Clone, Eq, PartialEq, FromSqlRow, Hash)]
@ -62,12 +62,12 @@ impl Handler<ComputeHash> for HasherWorker {
type Result = Result<Hash>;
fn handle(&mut self, msg: ComputeHash, _: &mut Self::Context) -> Self::Result {
msg.path.hash()
msg.path.as_path().hash()
}
}
impl Hashable for PathBuf {
fn hash(self: &PathBuf) -> Result<Hash> {
impl Hashable for Path {
fn hash(self: &Path) -> Result<Hash> {
trace!("Hashing {:?}...", self);
let fbuffer = FileBuffer::open(self)?;
trace!("Finished hashing {:?}...", self);