/// Computes the file hash or logs an error and returns none if failed.
/// If file is not found, no error is logged and `None` is returned.
Computes the file hash or logs an error and returns none if failed.
If file is not found, no error is logged and `None` is returned.
Computes the file hash or logs an error and returns none if failed . If file is not found no error is logged and ` None ` is returned .
pub(crate) fn file_hash_or_log_err(
    path: &Path,
    offset: FilePos,
    len: FileLen,
    buf_len: usize,
    caching: Caching,
    progress: impl Fn(usize),
    log: &Log,
) -> Option<FileHash> {
    match file_hash(path, offset, len, buf_len, caching, progress) {
        Ok(hash) => Some(hash),
        Err(e) if e.kind() == ErrorKind::NotFound => None,
        Err(e) => {
            log.warn(format!(
                "Failed to compute hash of file {}: {}",
                path.display(),
                e
            ));
            None
        }
    }
}
pub ( crate ) fn file_hash_or_log_err ( path : & Path , offset : FilePos , len : FileLen , buf_len : usize , caching : Caching , progress : impl Fn ( usize ) , log : & Log , ) -> Option < FileHash > { match file_hash ( path , offset , len , buf_len , caching , progress ) { Ok ( hash ) => Some ( hash ) , Err ( e ) if e . kind ( ) == ErrorKind :: NotFound => None , Err ( e ) => { log . warn ( format ! ( " " path display ( ) e ) ) ; None } } }
Computes the file hash or logs an error and returns none if failed.
Computes the file hash or logs an error and returns none if failed .
path
&Path
offset
FilePos
len
FileLen
buf_len
usize
caching
Caching
progress
impl Fn(usize)
log
&Log