Checksum

Trait Checksum 

Source
pub trait Checksum {
    // Provided methods
    fn get_hash<R>(reader: &mut R, hasher: &mut Sha384) -> Result<String, Error>
       where R: Read { ... }
    fn get_hash_path(src: &Path, hasher: &mut Sha384) -> Result<String, Error> { ... }
    fn checksum_folder(src: &Path, num_threads: usize) -> Result<(), Error> { ... }
    fn get_write_hashes(src: &Path) -> Result<(), Error> { ... }
    fn write_checksum<W: Write>(
        writer: &mut W,
        hashes: Vec<(PathBuf, String)>,
    ) -> Result<(), Error> { ... }
    fn checksum_lang(src: &Path) -> Result<Vec<(PathBuf, String)>, Error> { ... }
}

Provided Methods§

Source

fn get_hash<R>(reader: &mut R, hasher: &mut Sha384) -> Result<String, Error>
where R: Read,

compute the hash of the file pointed by the filepath by using io::copy between a file handler and the hasher. As such, it shouldn’t make the program go OOM with big files, but it has not been tested. Can return an error if there has been problems regarding IO.

Source

fn get_hash_path(src: &Path, hasher: &mut Sha384) -> Result<String, Error>

corpus/lang/lang_part_x.jsonl

Source

fn checksum_folder(src: &Path, num_threads: usize) -> Result<(), Error>

this should operate on the wide-level.

Source

fn get_write_hashes(src: &Path) -> Result<(), Error>

convinience function for checksum_folder TODO: move out of trait

Source

fn write_checksum<W: Write>( writer: &mut W, hashes: Vec<(PathBuf, String)>, ) -> Result<(), Error>

Source

fn checksum_lang(src: &Path) -> Result<Vec<(PathBuf, String)>, Error>

this should operate on lang-level

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§