pub fn from_file(path: &Path) -> io::Result<Self> {
        let mut reader = BufReader::new(File::open(path)?);
        let mut hasher = MeowHasher::new();
        let mut buffer = [0; 1024];

        loop {
            let bytes_read = reader.read(&mut buffer)?;

            if bytes_read != 0 {
                hasher.update(&buffer[..bytes_read]);
            } else {
                break;
            }
        }

        let hash = hasher.finalise().as_u128();

        Ok(Self { hash })
    }
/// Read the contents of a file and translate them into a ContentHash
Read the contents of a file and translate them into a ContentHash
Read the contents of a file and translate them into a ContentHash
pub fn from_file(path: &Path) -> io::Result<Self> {
        let mut reader = BufReader::new(File::open(path)?);
        let mut hasher = MeowHasher::new();
        let mut buffer = [0; 1024];
        loop {
            let bytes_read = reader.read(&mut buffer)?;
            if bytes_read != 0 {
                hasher.update(&buffer[..bytes_read]);
            } else {
                break;
            }
        }
        let hash = hasher.finalise().as_u128();
        Ok(Self { hash })
    }
pub fn from_file ( path : & Path ) -> io :: Result < Self > { let mut reader = BufReader :: new ( File :: open ( path ) ? ) ; let mut hasher = MeowHasher :: new ( ) ; let mut buffer = [ 0 ; 1024 ] ; loop { let bytes_read = reader . read ( & mut buffer ) ? ; if bytes_read != 0 { hasher . update ( & buffer [ .. bytes_read ] ) ; } else { break ; } } let hash = hasher . finalise ( ) . as_u128 ( ) ; Ok ( Self { hash } ) }
Read the contents of a file and translate them into a ContentHash
Read the contents of a file and translate them into a ContentHash
path
&Path