chore: bump deps; fix clippy lints & cleanup

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4c4815ad145650a07f108614034d2e996a6a6964
This commit is contained in:
raf 2026-03-02 17:05:28 +03:00
commit cd1161ee5d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
41 changed files with 1283 additions and 740 deletions

View file

@ -4,6 +4,19 @@ use crate::{error::Result, model::ContentHash};
const BUFFER_SIZE: usize = 65536;
/// Computes the BLAKE3 hash of a file asynchronously.
///
/// # Arguments
///
/// * `path` - Path to the file to hash
///
/// # Returns
///
/// The content hash
///
/// # Errors
///
/// Returns I/O errors or task execution errors
pub async fn compute_file_hash(path: &Path) -> Result<ContentHash> {
let path = path.to_path_buf();
let hash = tokio::task::spawn_blocking(move || -> Result<ContentHash> {
@ -24,6 +37,7 @@ pub async fn compute_file_hash(path: &Path) -> Result<ContentHash> {
Ok(hash)
}
/// Computes the BLAKE3 hash of a byte slice synchronously.
pub fn compute_hash_sync(data: &[u8]) -> ContentHash {
let hash = blake3::hash(data);
ContentHash::new(hash.to_hex().to_string())