Skip to main content

BuildChecksumer

Trait BuildChecksumer 

Source
pub trait BuildChecksumer {
    type Checksumer: Checksumer;

    // Required methods
    fn build_checksumer(&self) -> Self::Checksumer;
    fn checksum_one(&self, src: &[u8]) -> u64;
}
Expand description

A trait for creating instances of Checksumer.

A BuildChecksumer is typically used to create Checksumers.

For each instance of BuildChecksumer, the Checksumers created by build_checksumer should be identical. That is, if the same stream of bytes is fed into each checksumer, the same output will also be generated.

Required Associated Types§

Source

type Checksumer: Checksumer

Type of the checksumer that will be created.

Required Methods§

Source

fn build_checksumer(&self) -> Self::Checksumer

Creates a new checksumer.

Each call to build_checksumer on the same instance should produce identical Checksumers.

§Examples
use dbutils::checksum::{BuildChecksumer, Crc32};

let s = Crc32::new();
let new_s = s.build_checksumer();
Source

fn checksum_one(&self, src: &[u8]) -> u64

Calculates the checksum of a byte slice.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§