pub trait GeneratorType {
type Output: FuzzyHashType;
const IS_CHECKSUM_EFFECTIVE: bool;
const MIN: u32;
const MIN_CONSERVATIVE: u32;
const MAX: u32;
// Required methods
fn processed_len(&self) -> Option<u32>;
fn update(&mut self, data: &[u8]);
fn finalize_with_options(
&self,
options: GeneratorOptions,
) -> Result<Self::Output, GeneratorError>;
// Provided method
fn finalize(&self) -> Result<Self::Output, GeneratorError> { ... }
}Expand description
The trait to represent a fuzzy hash generator.
This trait is implemented by Generator.
Required Associated Constants§
Sourceconst IS_CHECKSUM_EFFECTIVE: bool
const IS_CHECKSUM_EFFECTIVE: bool
Whether the checksum is updated by this generator type.
If this type is false, the resulting fuzzy hash from this
generator will have checksum part with all zeroes.
In the official TLSH implementation, it is always true
except multi-threaded and private modes. This crate currently
does not support those modes but will be implemented in the future.
Sourceconst MIN_CONSERVATIVE: u32
const MIN_CONSERVATIVE: u32
The minimum data length (on the conservative mode).
Required Associated Types§
Sourcetype Output: FuzzyHashType
type Output: FuzzyHashType
The output type.
Required Methods§
Sourcefn processed_len(&self) -> Option<u32>
fn processed_len(&self) -> Option<u32>
Sourcefn finalize_with_options(
&self,
options: GeneratorOptions,
) -> Result<Self::Output, GeneratorError>
fn finalize_with_options( &self, options: GeneratorOptions, ) -> Result<Self::Output, GeneratorError>
Finalize the fuzzy hash with specified options.
You will likely use the default options and use
finalize() instead.
Provided Methods§
Sourcefn finalize(&self) -> Result<Self::Output, GeneratorError>
fn finalize(&self) -> Result<Self::Output, GeneratorError>
Finalize the fuzzy hash with the default options.
If you want to use a custom generator options,
use finalize_with_options()
instead.
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.