Function rapidhash_file_inline

Source
pub fn rapidhash_file_inline(data: &mut File, seed: u64) -> Result<u64>
Expand description

Rapidhash a file, matching the C++ implementation.

This method will check the metadata for a file length, and then stream the file with a BufReader to compute the hash. This avoids loading the entire file into memory.

We could easily add more ways to read other streams that can be converted to a BufReader, but the length must be known at the start of the stream due to how rapidhash is seeded using the data length. Raise a GitHub issue if you have a use case to support other stream types.

Is marked with #[inline(always)] to force the compiler to inline and optimise the method. Can provide large performance uplifts for inputs where the length is known at compile time.