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§
Sourcetype Checksumer: Checksumer
type Checksumer: Checksumer
Type of the checksumer that will be created.
Required Methods§
Sourcefn build_checksumer(&self) -> Self::Checksumer
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();Sourcefn checksum_one(&self, src: &[u8]) -> u64
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".